<?php
// Diagnostic script to check current site settings

require_once 'config/database.php';
require_once 'includes/site_settings.php';

echo "<h2>Current Site Settings</h2>";

try {
    // Get all settings
    $all_settings = get_all_settings($pdo);
    
    if (!empty($all_settings)) {
        echo "<table border='1' cellpadding='5' cellspacing='0'>";
        echo "<tr><th>Setting Key</th><th>Value</th></tr>";
        foreach ($all_settings as $key => $value) {
            echo "<tr><td>" . htmlspecialchars($key) . "</td><td>" . htmlspecialchars($value) . "</td></tr>";
        }
        echo "</table>";
    } else {
        echo "<p>No settings found in the database.</p>";
    }
    
    // Specifically check the system names
    echo "<h3>System Names</h3>";
    $system_name = get_setting($pdo, 'system_name', 'স্কুল ম্যানেজমেন্ট সিস্টেম');
    $system_name_en = get_setting($pdo, 'system_name_en', 'School Management System');
    
    echo "<p>Bengali System Name: " . htmlspecialchars($system_name) . "</p>";
    echo "<p>English System Name: " . htmlspecialchars($system_name_en) . "</p>";
    
} catch (Exception $e) {
    echo "<p>Error: " . $e->getMessage() . "</p>";
}
?>