load(); if (!isset($_ENV['DB_FILE_PATH'])) { die('DB_FILE_PATH is not set in the .env file'); } if (!file_exists('../' . $_ENV['DB_FILE_PATH'])) { die('Database file does not exist'); } // Get the selected album $album = $_GET['album'] ?? ''; $album = urldecode($album); if (empty($album)) { header("Location: index.php"); exit; } // Pagination settings $limit = 24; // Number of images per page $page = isset($_GET['page']) ? (int)$_GET['page'] : 1; $offset = ($page - 1) * $limit; // Create a new Database connection $dbFilePath = '../' . $_ENV['DB_FILE_PATH']; $database = new Database($dbFilePath); $image = new Image($database); // Get images and total count for the selected album $images = $image->getImages($album, $limit, $offset); $totalImages = $image->countImages($album); $totalPages = ceil($totalImages / $limit); // Limit the number of pages displayed in the pagination $paginationRange = $_ENV['PAGINATION_RANGE'] ?? 5; $startPage = max(1, $page - floor($paginationRange / 2)); $endPage = min($totalPages, $startPage + $paginationRange - 1); ?> Photo Gallery - <?= htmlspecialchars($album) ?>

- Gallery

← Back to Albums
<?= htmlspecialchars($image['title']) ?>

1): ?>