<?php
require_once __DIR__ . '/../../config.php';
require_once __DIR__ . '/../../engine/Kernel.php';
Kernel::handle(['auth' => false, 'public' => true]);
require_once __DIR__ . '/../../engine/Logger.php';
start_secure_session();
if (!empty($_SESSION['user_id']) && !empty($_SESSION['session_token'])) {
    db()->prepare('DELETE FROM sessions WHERE user_id = ? AND token = ?')->execute([$_SESSION['user_id'], hash('sha256', $_SESSION['session_token'])]);
}
session_destroy();
json_response(['success' => true]);
