[AppDB] adminScreenshots: avoid database error

Rosanne DiMesio dimesio at earthlink.net
Thu Jun 1 09:22:10 CDT 2017


Allows the Screenshots Management page to load even
if there are no screenshots in the database.

Signed-off-by: Rosanne DiMesio <dimesio at earthlink.net>
---
 admin/adminScreenshots.php | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/admin/adminScreenshots.php b/admin/adminScreenshots.php
index 96e3759..d552ca8 100644
--- a/admin/adminScreenshots.php
+++ b/admin/adminScreenshots.php
@@ -59,7 +59,10 @@ $ItemsPerPage = isset($aClean['iItemsPerPage']) ? $aClean['iItemsPerPage'] : 6;
 $currentPage = isset($aClean['iPage']) ? $aClean['iPage'] : 1;
 
 $ItemsPerPage = min($ItemsPerPage,100);
-$totalPages = ceil(screenshot::objectGetEntriesCount('accepted')/$ItemsPerPage);
+$realTotalPages = screenshot::objectGetEntriesCount('accepted');
+$totalPages = 1;
+if($realTotalPages >= $ItemsPerPage)
+   $totalPages = ceil($realTotalPages/$ItemsPerPage);
 $currentPage = min($currentPage,$totalPages);
 $offset = (($currentPage-1) * $ItemsPerPage);
 
-- 
2.12.0




More information about the wine-patches mailing list