<?php
/**
 * User Logout
 */
require_once __DIR__ . '/includes/init.php';

if (SessionManager::isLoggedIn()) {
    $userId = SessionManager::getUserId();
    log_action($userId, 'logout', 'users', $userId);
}

logout_user();
set_success('You have been logged out successfully.');
redirect(APP_URL . '/login.php');
