<?php
declare(strict_types=1);

$script = (string)($_SERVER['SCRIPT_NAME'] ?? '');
$isDashboard = (bool)preg_match('~/admin/index\.php$~', $script);
?>
<header>
<?php if ($isDashboard): ?>
  <div>
    <a href="../" target="_blank" rel="noopener">公開側トップ</a>
  </div>
  <div>
    <a href="./logout.php">ログアウト</a>
  </div>
<?php else: ?>
  <div>
    <a href="./">ダッシュボード</a>
    <a href="../" target="_blank" rel="noopener">公開側トップ</a>
  </div>
  <div>
    <a href="./logout.php">ログアウト</a>
  </div>
<?php endif; ?>
</header>
