diff --git a/Source/Source.API.php b/Source/Source.API.php index ade4ad9..53615d3 100644 --- a/Source/Source.API.php +++ b/Source/Source.API.php @@ -472,7 +472,7 @@ * Get a list of repository statistics. * @return array Stats */ - function stats() { + function stats( $p_all=true ) { $t_stats = array(); $t_changeset_table = plugin_table( 'changeset', 'Source' ); @@ -482,17 +482,19 @@ $t_query = "SELECT COUNT(*) FROM $t_changeset_table WHERE repo_id=" . db_param(); $t_stats['changesets'] = db_result( db_query_bound( $t_query, array( $this->id ) ) ); - $t_query = "SELECT COUNT(DISTINCT filename) FROM $t_file_table AS f - JOIN $t_changeset_table AS c - ON c.id=f.change_id - WHERE c.repo_id=" . db_param(); - $t_stats['files'] = db_result( db_query_bound( $t_query, array( $this->id ) ) ); + if ( $p_all ) { + $t_query = "SELECT COUNT(DISTINCT filename) FROM $t_file_table AS f + JOIN $t_changeset_table AS c + ON c.id=f.change_id + WHERE c.repo_id=" . db_param(); + $t_stats['files'] = db_result( db_query_bound( $t_query, array( $this->id ) ) ); - $t_query = "SELECT COUNT(DISTINCT bug_id) FROM $t_bug_table AS b - JOIN $t_changeset_table AS c - ON c.id=b.change_id - WHERE c.repo_id=" . db_param(); - $t_stats['bugs'] = db_result( db_query_bound( $t_query, array( $this->id ) ) ); + $t_query = "SELECT COUNT(DISTINCT bug_id) FROM $t_bug_table AS b + JOIN $t_changeset_table AS c + ON c.id=b.change_id + WHERE c.repo_id=" . db_param(); + $t_stats['bugs'] = db_result( db_query_bound( $t_query, array( $this->id ) ) ); + } return $t_stats; } diff --git a/Source/pages/list.php b/Source/pages/list.php index 92d37bc..0d4cdfd 100644 --- a/Source/pages/list.php +++ b/Source/pages/list.php @@ -22,7 +22,7 @@ $t_repo = SourceRepo::load( $f_repo_id ); $t_type = SourceType($t_repo->type); -$t_stats = $t_repo->stats(); +$t_stats = $t_repo->stats( false ); $t_changesets = SourceChangeset::load_by_repo( $t_repo->id, true, $f_offset, $f_perpage ); html_page_top1( plugin_lang_get( 'title' ) ); @@ -71,7 +71,7 @@ $t_used_page = false; for( $i = 1; $i <= $t_pages; $i++ ) { if ( $i <= 3 || $i > $t_pages-3 || - ( $i >= $t_current-4 && $i <= $t_current+4 ) || + ( $i >= $t_current-5 && $i <= $t_current+5 ) || $i % $t_block == 0) { $t_page_set[] = $i;