<?php
// api/logout.php
session_start();
require_once '../config/database.php';
require_once '../includes/functions.php';

if (isset($_SESSION['user_id'])) {
    logActivity($_SESSION['user_id'], 'LOGOUT', 'User logged out');
}

session_destroy();
header("Location: ../index.php?page=login");
exit;
