0 ? (int)$_GET['page'] : 1; $offset = ($page - 1) * $videosPerPage; // Fetch total number of active videos for pagination $countStmt = $db->prepare("SELECT COUNT(*) FROM youtube_videos WHERE status = 'active'"); $countStmt->execute(); $totalVideos = $countStmt->fetchColumn(); $totalPages = ceil($totalVideos / $videosPerPage); // Fetch active videos for the current page $stmt = $db->prepare("SELECT id, title, description, video_id, created_at FROM youtube_videos WHERE status = 'active' ORDER BY created_at DESC LIMIT :limit OFFSET :offset"); $stmt->bindValue(':limit', $videosPerPage, PDO::PARAM_INT); $stmt->bindValue(':offset', $offset, PDO::PARAM_INT); $stmt->execute(); $videos = $stmt->fetchAll(PDO::FETCH_ASSOC); // Sanitize content for safe display foreach ($videos as &$video) { $video['title'] = htmlspecialchars($video['title']); $video['description'] = htmlspecialchars($video['description'] ? strip_tags($video['description']) : 'कोई विवरण उपलब्ध नहीं है।'); } $pageTitle = 'Our videos'; include 'header.php'; include 'navbar.php'; ?>