<?php
header('Content-Type: application/xml; charset=UTF-8');
$scheme = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
$currentHost = isset($_SERVER['HTTP_HOST']) ? preg_replace('/[^A-Za-z0-9.\-:]/', '', $_SERVER['HTTP_HOST']) : '';
$baseUrl = $currentHost ? $scheme . '://' . $currentHost : '';
$pages = array('/', '/film/', '/shorts/', '/life/', '/ai/', '/salon/', '/contact/', '/classic-film/', '/artistic-diary/', '/poetic-cinema/', '/filter-workshop/', '/story-film/');
echo '<?xml version="1.0" encoding="UTF-8"?>' . "
";
?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<?php foreach ($pages as $page): ?>
  <url>
    <loc><?php echo htmlspecialchars($baseUrl . $page, ENT_XML1, 'UTF-8'); ?></loc>
    <lastmod><?php echo date('Y-m-d'); ?></lastmod>
    <changefreq>daily</changefreq>
    <priority><?php echo $page === '/' ? '1.0' : '0.82'; ?></priority>
  </url>
<?php endforeach; ?>
</urlset>
