<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

$ROOT = __DIR__; // /var/www/html

require_once $ROOT.'/.hta_config/conf.php';
require_once $ROOT.'/.hta_config/var.php';
require_once $ROOT.'/.hta_slug/_header.php';
require_once $ROOT.'/.hta_slug/_nav.php';

$url = explode('/', trim($_SERVER['REQUEST_URI'], '/'));
$slug = $url[0] ?? '';

if ($slug === '') {
    require_once $ROOT.'/.hta_slug/_home.php';
} elseif (file_exists($ROOT.'/.hta_slug/'.$slug.'.php')) {
    require_once $ROOT.'/.hta_slug/'.$slug.'.php';
} else {
    require_once $ROOT.'/.hta_slug/_404.php';
}

require_once $ROOT.'/.hta_slug/_footer.php';
