<?php
// Suppress deprecation warnings
error_reporting(E_ALL & ~E_DEPRECATED & ~E_STRICT);
ini_set('display_errors', 1);

session_start();

require '../../config.php';
require '../admin_config.php';
require '../functions.php';
require '../views/header.view.php';

if (isset($_SESSION['user_email'])){

$connect = connect($database);
if(!$connect){
    header('Location: ./error.php');
}

$check_access = check_access($connect);

if ($check_access['user_role'] == 1){
    
    // Set minimal variables
    $totalPages = 8;
    $totalPosts = 2;
    $totalStores = 0;
    $totalCoupons = 0;
    $totalUrls = 10;
    $robotsContent = "User-agent: *\nAllow: /";
    
    echo "<h1>SEO Tools Test Page</h1>";
    echo "<p>If you see this, the controller works!</p>";
    echo "<p>Total URLs: $totalUrls</p>";
    
    // Try to include the view
    echo "<hr><h2>Now including the view...</h2>";
    require '../views/seo_tools.view.php';
	
}else{
	header('Location:'.SITE_URL);
}

require '../views/footer.view.php';

}else{
	header('Location: ./login.php');	
}

?>
