Rosanne DiMesio : adminScreenshots: avoid database error
Jeremy Newman
jnewman at winehq.org
Thu Jun 1 10:17:41 CDT 2017
Module: appdb
Branch: master
Commit: 49a78f65efc9629199427b9ce859d78b8c10b6bf
URL: http://source.winehq.org/git/appdb.git/?a=commit;h=49a78f65efc9629199427b9ce859d78b8c10b6bf
Author: Rosanne DiMesio <dimesio at earthlink.net>
Date: Thu Jun 1 09:22:10 2017 -0500
adminScreenshots: avoid database error
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>
Signed-off-by: Jeremy Newman <jnewman at codeweavers.com>
---
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);
More information about the wine-cvs
mailing list