<?php
session_start();
require_once __DIR__ . '/includes/db.php';
require_once __DIR__ . '/includes/activity_logger.php';

if (isset($_SESSION['user_id'])) {
    log_activity($_SESSION['user_id'], 'User Logout', 'User ' . $_SESSION['username'] . ' logged out.');
}

session_unset();
session_destroy();
header('Location: login.php');
exit();
?>