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

$page = $_GET['page'] ?? 'home';
$allowed = [
    'home' => __DIR__ . '/../pages/home.php',
    'products' => __DIR__ . '/../pages/products.php',
    'product_detail' => __DIR__ . '/../pages/product_detail.php',
    'about' => __DIR__ . '/../pages/about.php',
    'cart' => __DIR__ . '/../pages/cart.php',
    'checkout' => __DIR__ . '/../pages/checkout.php',
    'payment_info' => __DIR__ . '/../pages/payment_info.php',
    'payment_confirm' => __DIR__ . '/../pages/payment_confirm.php',
    'orders' => __DIR__ . '/../pages/orders.php',
    'invoice' => __DIR__ . '/../pages/invoice.php',
];

if (!isset($allowed[$page])) {
    $page = 'home';
}

require $allowed[$page];
