mirror of
https://github.com/myronblair/tomsjavajive
synced 2026-06-30 17:50:32 -05:00
Fix remaining code review findings: email transport errors, metadata payload, from-name, pagination
- Email::send(): add curl_error() check so transport failures (timeout, DNS, TLS) return a diagnosable error string instead of Unknown error - Email::send(): strip metadata key from options before array_merge so non-API fields are never sent to CyberMail endpoint - Email::send() + sendEmail(): include from-name in From field using RFC 5322 "Name <email>" format so fromName DB setting takes effect - email-log.php: replace unbounded page-link loop with a windowed paginator (first/last 2 pages + ±2 around current) with ellipsis gaps — prevents hundreds of anchors rendering at scale
This commit is contained in:
+19
-5
@@ -217,16 +217,30 @@ $statusBadge = [
|
||||
</div>
|
||||
|
||||
<!-- Pagination -->
|
||||
<?php if ($totalPages > 1): ?>
|
||||
<div style="display:flex;justify-content:center;gap:8px;margin-top:20px;">
|
||||
<?php for ($i = 1; $i <= $totalPages; $i++): ?>
|
||||
<a href="?page=<?= $i ?>&search=<?= urlencode($search) ?>&status=<?= urlencode($statusFilter) ?>&customer=<?= urlencode($customerFilter) ?>"
|
||||
<?php if ($totalPages > 1):
|
||||
$window = 2;
|
||||
$pages = [];
|
||||
for ($i = 1; $i <= $totalPages; $i++) {
|
||||
if ($i <= $window || $i > $totalPages - $window || abs($i - $page) <= $window) {
|
||||
$pages[] = $i;
|
||||
}
|
||||
}
|
||||
$pages = array_unique($pages);
|
||||
sort($pages);
|
||||
$qs = '&search=' . urlencode($search) . '&status=' . urlencode($statusFilter) . '&customer=' . urlencode($customerFilter);
|
||||
?>
|
||||
<div style="display:flex;justify-content:center;gap:8px;margin-top:20px;flex-wrap:wrap;">
|
||||
<?php $prev = null; foreach ($pages as $i):
|
||||
if ($prev !== null && $i - $prev > 1): ?>
|
||||
<span style="padding:6px 4px;color:#9CA3AF;">…</span>
|
||||
<?php endif; ?>
|
||||
<a href="?page=<?= $i ?><?= $qs ?>"
|
||||
style="padding:6px 12px;border-radius:4px;text-decoration:none;
|
||||
background:<?= $i === $page ? '#FF5E1A' : '#f3f4f6' ?>;
|
||||
color:<?= $i === $page ? 'white' : '#374151' ?>;">
|
||||
<?= $i ?>
|
||||
</a>
|
||||
<?php endfor; ?>
|
||||
<?php $prev = $i; endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user