Check for zero builds count and if so, set pages count to 1.

This commit is contained in:
Dmitrijs Vrublevskis 2014-06-27 19:24:44 +03:00
parent 4a7495a75d
commit d5e2ce9334

View file

@ -59,7 +59,7 @@ class ProjectController extends \PHPCI\Controller
$per_page = 10;
$page = $this->getParam('p', 1);
$builds = $this->getLatestBuildsHtml($projectId, (($page - 1) * $per_page));
$pages = ceil($builds[1] / $per_page);
$pages = $builds[1] == 0 ? 1 : ceil($builds[1] / $per_page);
if ($page > $pages) {
throw new NotFoundException('Page with number: ' . $page . ' not found');