<?php
/**
 * Logout Page
 * Research Survey Management System
 */

require_once __DIR__ . '/../includes/functions.php';

logAudit('logout', 'user', $_SESSION['user_id'] ?? null);
logoutUser();

$_SESSION['flash_message'] = 'You have been successfully logged out.';
$_SESSION['flash_type'] = 'info';

header('Location: ' . BASE_URL . '/pages/login.php');
exit;