<?php 
// Temporäre Fehlerausgabe und Logging für Debugzwecke
ini_set('display_errors', '0');
ini_set('log_errors', '1');
ini_set('error_reporting', (string)E_ALL);
ini_set('error_log', __DIR__ . '/php-error.log');

if (isset($_REQUEST['q']) && substr($_REQUEST['q'], -4) === '.php') {
    $url = substr($_REQUEST['q'], 0, -4);
    header('Location: ' . $url, true, 301);
    die();
}
if (isset($_REQUEST['q']) && file_exists('include/' . $_REQUEST['q'] . '.php')) {
    include 'include/' . $_REQUEST['q'] . '.php';
    $className = ucfirst($_REQUEST['q']);
    $renderer = new $className(null);
} else {
    include 'include/renderer.php'; 
    $renderer = new Renderer(null);
}
$renderer->render();
