Module: appdb Branch: master Commit: 49a78f65efc9629199427b9ce859d78b8c10b6bf URL: http://source.winehq.org/git/appdb.git/?a=commit;h=49a78f65efc9629199427b9ce...
Author: Rosanne DiMesio dimesio@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@earthlink.net Signed-off-by: Jeremy Newman jnewman@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);