<?php
header('Content-Type: application/pdf');
header('Content-Disposition: attachment; filename="' . basename($_GET['filename']) . '"');
header('Cache-Control: private, max-age=0, must-revalidate');
header('Pragma: public');

$filename = $_GET['filename'] ?? '';
$filepath = '../uploads/offers/' . basename($filename);

if (!file_exists($filepath)) {
    http_response_code(404);
    echo 'PDF-Datei nicht gefunden';
    exit;
}

readfile($filepath);
?>
