Index: forum.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/forum.module,v
retrieving revision 1.305
diff -u -F^f -r1.305 forum.module
--- forum.module	20 Jan 2006 09:04:34 -0000	1.305
+++ forum.module	27 Jan 2006 21:58:51 -0000
@@ -951,7 +951,10 @@ function theme_forum_list($forums, $pare
  * @ingroup themeable
  */
 function theme_forum_topic_list($tid, $topics, $sortby, $forum_per_page) {
-  global $forum_topic_list_header;
+  global $forum_topic_list_header, $pager_total;
+
+  $on_page = $_GET['q']; // store current url
+  $forum_pager_total = $pager_total;
 
   if ($topics) {
 
@@ -965,9 +968,22 @@ function theme_forum_topic_list($tid, $t
         );
       }
       else {
+        // find number of comments per page
+        $comments_per_page = $_GET['comments_per_page'];
+        if (empty($comments_per_page)) {
+          $comments_per_page = $user->comments_per_page ? $user->comments_per_page : ($_SESSION   ['comment_comments_per_page'] ? $_SESSION['comment_comments_per_page'] : variable_get('comment_default_per_page', '50'));
+        }
+        // compute page_links
+        $pager_total = array( 0 => ceil( $topic->num_comments / $comments_per_page ));
+        $_GET['q'] = "node/$topic->nid";
+        $page_links = theme('pager', NULL, NULL, 0, array('comments_per_page' => $comments_per_page), 0);
+        $_GET['q'] = $on_page; // retrieve url
+        $pager_total = $forum_pager_total; // retrieve global value
+
+        // organize topic row
         $rows[] = array(
           array('data' => theme('forum_icon', $topic->new, $topic->num_comments, $topic->comment_mode, $topic->sticky), 'class' => 'icon'),
-          array('data' => l($topic->title, "node/$topic->nid"), 'class' => 'topic'),
+          array('data' => l($topic->title, "node/$topic->nid").$page_links, 'class' => 'topic'),
           array('data' => $topic->num_comments . ($topic->new_replies ? '<br />'. l(format_plural($topic->new_replies, '1 new', '%count new'), "node/$topic->nid", NULL, NULL, 'new') : ''), 'class' => 'replies'),
           array('data' => _forum_format($topic), 'class' => 'created'),
           array('data' => _forum_format($topic->last_reply), 'class' => 'last-reply')
