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

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="Styles/styles.css">
    <title>Task 1 - Custom CMS</title>
</head>

<body>
    <?php include "Pages/nav.php"; ?>

    <?php
        $page 
= "welcome"; // default page

        
if (isset($_GET['page'])) {
            
$page = $_GET['page'];
        }

        
$filePath = "Pages/" . $page . ".php";

        if (
$page === "cms") {
            include_once 
"cms.php"; // cms.php is not in pages folder and has to be checked seperately
        
} elseif (file_exists($filePath)) {
            include_once 
$filePath; 
        } else {
            include_once 
"Pages/page_not_found.php";
        }
    
?>
</body>
</html>