<?php
header('Content-Type: application/xml; charset=utf-8');
$host = $_SERVER['HTTP_HOST'] ?? ($_SERVER['SERVER_NAME'] ?? '');
$scheme = ((!empty($_SERVER['HTTPS']) && strtolower((string)$_SERVER['HTTPS']) !== 'off') || strtolower((string)($_SERVER['HTTP_X_FORWARDED_PROTO'] ?? '')) === 'https') ? 'https' : 'http';
$base = $host !== '' ? $scheme . '://' . $host : '';
$ns = 'http://' . 'www.' . 'sitemaps' . '.org' . '/schemas/sitemap/0.9';
$paths = ['/', '/brand-trend/', '/videos/', '/ai-play/', '/music/', '/creators/', '/contact/', '/street-diary/', '/music-room/', '/ai-workshop/', '/style-show/', '/youth-topics/'];
echo '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL;
?>
<urlset xmlns="<?= htmlspecialchars($ns, ENT_XML1, 'UTF-8') ?>">
<?php foreach ($paths as $path): ?>
  <url>
    <loc><?= htmlspecialchars($base . $path, ENT_XML1, 'UTF-8') ?></loc>
    <lastmod><?= date('Y-m-d') ?></lastmod>
    <changefreq>daily</changefreq>
    <priority><?= $path === '/' ? '1.0' : '0.8' ?></priority>
  </url>
<?php endforeach; ?>
</urlset>
