<?php
$tenant = preg_replace('/[^A-Za-z0-9._\/-]/', '', (string)($_REQUEST['tenant'] ?? ''));
define('TENANT_URL', $tenant);

$cacheFile = '../../..' . TENANT_URL . '/framework/dashboard_functions/reports.txt';
$record = is_file($cacheFile) ? (string)file_get_contents($cacheFile) : '';
$record = explode("|", $record, 2);
$record[1] = $record[1] ?? '';
?>

<div class="col-md-6">
    <div class="card">
        <div class="card-header">Reports Not Sent</div>
        <div class="card-body" style="max-height:200px; overflow: auto">
            <table id="datatable" class="table table-sm table-striped">
                <?php
echo !empty($record[1]) ? $record[1] : "<tr><td>No reports cache available.</td></tr>";
//printf("Total time cached query: %.6fs\n", microtime(true) - $start);
?>
            </table>
        </div>
        <div class="card-footer border-0"></div>
    </div>
</div>
