Ignore:
Timestamp:
Jan 15, 2005, 12:16:46 PM (19 years ago)
Author:
plg
Message:
  • bug fixed : count the exact number of elements that can be displayed in most_visited category because it can be less than $conftop_number
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/functions_category.inc.php

    r676 r694  
    593593
    594594        $conf['order_by'] = ' ORDER BY hit DESC, file ASC';
    595         $page['cat_nb_images'] = $conf['top_number'];
     595
     596        // $page['cat_nb_images'] equals $conf['top_number'] unless there
     597        // are less visited items
     598        $query ='
     599SELECT COUNT(DISTINCT(id)) AS count
     600  FROM '.IMAGES_TABLE.'
     601    INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id
     602  '.$page['where'].'
     603;';
     604        $row = mysql_fetch_array(pwg_query($query));
     605        if ($row['count'] < $conf['top_number'])
     606        {
     607          $page['cat_nb_images'] = $row['count'];
     608        }
     609        else
     610        {
     611          $page['cat_nb_images'] = $conf['top_number'];
     612        }
     613        unset($query);
     614       
    596615        if ( isset( $page['start'] )
    597616             and ($page['start']+$user['nb_image_page']>=$conf['top_number']))
Note: See TracChangeset for help on using the changeset viewer.