<?php
require 'db.php';
require 'functions.php';

if (isLoggedIn() && currentRole() === 'admin') {
    logActivity($pdo, 'adminuser', currentUserId(), 'logout', 'admin', currentUserId(), 'Admin logged out');
}
$_SESSION = [];
session_destroy();
header('Location: admin_login.php');
exit;
