= 20; $link = $blocked ? null : data_export_link_find($token); if ($link === null && !$blocked) { rate_limit_add('export_link_fail', $ipKey); } $error = null; if ($link !== null && $_SERVER['REQUEST_METHOD'] === 'POST') { verify_csrf(); db()->prepare('UPDATE data_export_links SET downloads = downloads + 1, last_download_at = NOW() WHERE id = ?') ->execute([(int) $link['id']]); admin_log('📦 Datenauskunft über Download-Link heruntergeladen', [ 'Benutzer' => admin_log_user((int) $link['user_id']), 'Download' => ((int) $link['downloads'] + 1) . ' von höchstens ' . DATA_EXPORT_LINK_MAX_DOWNLOADS, ], 'info', 'users'); try { data_export_send((int) $link['user_id']); } catch (Throwable $e) { $error = 'Die Daten konnten nicht zusammengestellt werden: ' . $e->getMessage(); } } if ($link === null) { http_response_code(404); } $pageTitle = 'Datenauskunft'; $publicLayout = true; $metaRobots = 'noindex'; include __DIR__ . '/includes/header.php'; ?>