0, 'offers' => 0, 'confirmed' => 0, ]; try { $pdo = db(); $stats['shipments'] = (int) $pdo->query("SELECT COUNT(*) FROM shipments")->fetchColumn(); $stats['offers'] = (int) $pdo->query("SELECT COUNT(*) FROM shipments WHERE offer_price IS NOT NULL")->fetchColumn(); $stats['confirmed'] = (int) $pdo->query("SELECT COUNT(*) FROM shipments WHERE status IN ('confirmed','in_transit','delivered')")->fetchColumn(); } catch (Throwable $e) { // Keep the landing page stable even if DB is unavailable. } $recentShipments = []; try { $stmt = db()->query("SELECT * FROM shipments ORDER BY created_at DESC LIMIT 5"); $recentShipments = $stmt->fetchAll(); } catch (Throwable $e) { $recentShipments = []; } render_header(t('app_name'), 'home'); try { $stmt = db()->query("SELECT * FROM landing_sections WHERE is_active = 1 ORDER BY section_order ASC, id ASC"); $landingSections = $stmt->fetchAll(); foreach ($landingSections as $sec): // Determine correct language for dynamic content $isAr = ($lang ?? 'en') === 'ar'; $title = ($isAr && !empty($sec['title_ar'])) ? $sec['title_ar'] : $sec['title']; $subtitle = ($isAr && !empty($sec['subtitle_ar'])) ? $sec['subtitle_ar'] : $sec['subtitle']; $content = ($isAr && !empty($sec['content_ar'])) ? $sec['content_ar'] : $sec['content']; $button_text = ($isAr && !empty($sec['button_text_ar'])) ? $sec['button_text_ar'] : $sec['button_text']; if ($sec['section_type'] === 'hero'): ?>

+
+
+

Logistics

1

2

3

>

getMessage() . " at " . $e->getFile() . ":" . $e->getLine()); } ?>