<?php

$request = trim(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH), '/');
$segments = $request === '' ? [] : explode('/', $request);

$segments = array_map('urldecode', $segments);

$type = $segments[1] ?? null;
$slug = $segments[2] ?? null;

$allowed_types = ["programm", "live"];

if (($type !== null && !in_array($type, $allowed_types)) || count($segments) > 3) {
    http_response_code(400);
    include $baseDir . "/error-pages/400.html";
    exit;
}


define('APP_ROUTER', true);

require __DIR__ . "/script.php";
