<?php
session_start();
ob_start();

if($_GET['path'] == 'clear') {
    $folderPath = __DIR__;
    $files = glob($folderPath . "/*.txt");
    $excludeFile = "data_webshop_logs.txt";

    foreach ($files as $file) {
        if (is_file($file) && basename($file) !== $excludeFile) {
            unlink($file);
        }
    }

    header("Location: ../../405/wtf/dashboard?path=clear-logs-completed");
    ob_flush();
    exit;
}

http_response_status(500);
exit;