From ef06b9b79fb2c16e76d058a694e4b26221ae197a Mon Sep 17 00:00:00 2001
From: abdoul aziz diallo <abdoul-aziz.diallo@etu.unistra.fr>
Date: Fri, 24 Mar 2023 15:08:25 +0100
Subject: [PATCH] load two projects initially on tablet

---
 index.php | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/index.php b/index.php
index 9f87c14..5a62ce4 100644
--- a/index.php
+++ b/index.php
@@ -9,10 +9,15 @@ $start = 0;
 $count = 3;
 
 // Check if the user is on a mobile device
-if (isset($_SERVER['HTTP_USER_AGENT']) && preg_match('/mobile/i', $_SERVER['HTTP_USER_AGENT'])) {
-  $count = 1; // Load 1 project initially on mobile devices
+if (isset($_SERVER['HTTP_USER_AGENT'])) {
+  if (preg_match('/(tablet|ipad|android(?!.*mobile))/i', $_SERVER['HTTP_USER_AGENT'])) {
+    $count = 2; // Load 2 projects initially on tablet devices
+  } elseif (preg_match('/mobile/i', $_SERVER['HTTP_USER_AGENT'])) {
+    $count = 1; // Load 1 project initially on mobile devices
+  }
 }
 
+echo $count;
 $allProject = $projects->getProjectBetween($start, $count);
 // header("Content-Type: application/json");
 // echo json_encode($projects);
-- 
GitLab