- bug fixed : count the exact number of elements that can be displayed in

most_visited category because it can be less than $conf['top_number']


git-svn-id: http://piwigo.org/svn/trunk@694 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
plegall
2005-01-15 11:16:46 +00:00
parent 46dcfba37d
commit cc5ba30bd0
+20 -1
View File
@@ -592,7 +592,26 @@ SELECT COUNT(DISTINCT(id)) AS nb_total_images
}
$conf['order_by'] = ' ORDER BY hit DESC, file ASC';
$page['cat_nb_images'] = $conf['top_number'];
// $page['cat_nb_images'] equals $conf['top_number'] unless there
// are less visited items
$query ='
SELECT COUNT(DISTINCT(id)) AS count
FROM '.IMAGES_TABLE.'
INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id
'.$page['where'].'
;';
$row = mysql_fetch_array(pwg_query($query));
if ($row['count'] < $conf['top_number'])
{
$page['cat_nb_images'] = $row['count'];
}
else
{
$page['cat_nb_images'] = $conf['top_number'];
}
unset($query);
if ( isset( $page['start'] )
and ($page['start']+$user['nb_image_page']>=$conf['top_number']))
{