<?php
session_start();
include 'conexao.php';
include 'config/log_utils.php';

if (isset($_SESSION['usuario_id'])) {
    $conn = conectar_banco();
    registrar_log_interacao(
        $conn,
        'LOGOUT',
        'Encerramento da sessao do usuario',
        ['modulo' => 'logout.php']
    );
    $conn->close();
}

session_destroy();
header('Location: login.php');
exit;
?>
