<?php
// SEO sitemap.xml (static URLs only)

if (session_status() === PHP_SESSION_NONE) {
    session_start();
}

$scheme = (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] === 'on' || $_SERVER['HTTPS'] === '1')) ? 'https' : 'http';
$host = $_SERVER['HTTP_HOST'] ?? 'localhost';
$baseUrl = rtrim($scheme . '://' . $host, '/');

$staticUrls = [
    '/index.php',
    '/about.php',
    '/services.php',
    '/projects.php',
    '/media.php',
    '/careers.php',
    '/contact.php',
];

header('Content-Type: application/xml; charset=utf-8');

echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<?php foreach ($staticUrls as $url): ?>
    <url>
        <loc><?= htmlspecialchars($baseUrl . $url) ?></loc>
        <lastmod><?= htmlspecialchars(gmdate('Y-m-d')) ?></lastmod>
        <changefreq>weekly</changefreq>
        <priority>0.6</priority>
    </url>
<?php endforeach; ?>
</urlset>

