<?php
session_start();
// Include dependencies for logging
require_once('../includes/config.php');
require_once('../includes/activity_logger.php');

if (isset($_SESSION['vendor_id'])) {
    $store_name = $_SESSION['vendor_username'] ?? 'Vendor';
    log_activity("Vendor Logout", "Store: $store_name logged out.", "vendor");
}

// Clear vendor session
unset($_SESSION['vendor_id']);
unset($_SESSION['vendor_user_id']);
unset($_SESSION['vendor_login']);
unset($_SESSION['vendor_username']);

session_destroy();
header('location: ../vendor-login.php');
exit;
?>