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

if (isset($_SESSION['user_id'])) {
    $pdo = getPDO();
    logAction($pdo, $_SESSION['user_id'], 'deconnexion');
}
session_destroy();
header('Location: ' . BASE_URL . 'index.php');
exit;