Index: modules/comment.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment.module,v
retrieving revision 1.367
diff -u -r1.367 comment.module
--- modules/comment.module	28 Aug 2005 15:16:58 -0000	1.367
+++ modules/comment.module	30 Aug 2005 15:07:14 -0000
@@ -900,7 +900,7 @@
       }
 
       // Start a form, for use with comment control and moderation.
-      $result = pager_query($query, $comments_per_page, 0, "SELECT COUNT(*) FROM {comments} WHERE status = %d AND nid = %d", $nid, COMMENT_PUBLISHED);
+      $result = pager_query($query, $comments_per_page, 0, "SELECT COUNT(*) FROM {comments} WHERE nid = %d AND status = %d", $nid, COMMENT_PUBLISHED);
       if (db_num_rows($result) && (variable_get('comment_controls', 3) == 0 || variable_get('comment_controls', 3) == 2)) {
         $output .= '<form method="post" action="'. url('comment') ."\"><div>\n";
         $output .= theme('comment_controls', $threshold, $mode, $order, $comments_per_page);
Index: themes/engines/phptemplate/phptemplate.engine
===================================================================
RCS file: /cvs/drupal/drupal/themes/engines/phptemplate/phptemplate.engine,v
retrieving revision 1.13
diff -u -r1.13 phptemplate.engine
--- themes/engines/phptemplate/phptemplate.engine	16 Aug 2005 18:06:18 -0000	1.13
+++ themes/engines/phptemplate/phptemplate.engine	30 Aug 2005 15:08:50 -0000
@@ -260,6 +260,9 @@
  * into a pluggable template engine.
  */
 function phptemplate_comment($comment, $links = 0) {
+  $comments_per_page = array_key_exists('comments_per_page', $_GET) ? $_GET['comments_per_page'] : '';
+  $page = array_key_exists('page', $_GET) ? $_GET['page'] : '';
+
   return _phptemplate_callback('comment', array(
     'author'    => theme('username', $comment),
     'comment'   => $comment,
@@ -271,7 +274,7 @@
     'submitted' => t('Submitted by %a on %b.',
                       array('%a' => theme('username', $comment),
                             '%b' => format_date($comment->timestamp))),
-    'title'     => l($comment->subject, $_GET['q'], NULL, NULL, "comment-$comment->cid")
+    'title'     => l($comment->subject, $_GET['q'], NULL, isset($page) ? 'page='.$page.''.'&comments_per_page='.$comments_per_page : NULL, "comment-$comment->cid")
   ));
 }
 
