<?php
session_start();
require_once __DIR__ . '/config/database.php';
require_once __DIR__ . '/database/schema.php';
require_once __DIR__ . '/models/functions.php';
require_once __DIR__ . '/functions.php';
initDatabase();

header('Cache-Control: no-cache, no-store, must-revalidate');
header('Pragma: no-cache');
header('Expires: 0');

$settings = getAllSettings();
$slug = $_GET['slug'] ?? '';
$category = getGalleryCategoryBySlug($slug);
if (!$category) {
    http_response_code(404);
    include __DIR__ . '/views/header.php';
    include __DIR__ . '/views/404.php';
    include __DIR__ . '/views/footer.php';
} else {
    $images = getGalleryImages($category['id']);
    include __DIR__ . '/views/header.php';
    include __DIR__ . '/views/gallery_detail.php';
    include __DIR__ . '/views/footer.php';
}
