<?php
require_once __DIR__ . '/../src/bootstrap.php';
require_once __DIR__ . '/../src/functions.php';

$token = trim($_GET['token'] ?? '');

if ($token !== '') {
    try {
        markOpenedByToken(db(), $token);
    } catch (\Throwable $e) {
        error_log('Open tracking error: ' . $e->getMessage());
    }
}

header('Content-Type: image/gif');
header('Cache-Control: no-cache, no-store, must-revalidate');
header('Pragma: no-cache');
header('Expires: 0');

echo base64_decode('R0lGODlhAQABAIABAP///wAAACwAAAAAAQABAAACAkQBADs=');
exit;
