Index: modules/comment/comment.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v
retrieving revision 1.635
diff -u -p -r1.635 comment.module
--- modules/comment/comment.module	9 Jun 2008 07:07:36 -0000	1.635
+++ modules/comment/comment.module	13 Jun 2008 08:32:41 -0000
@@ -589,8 +589,10 @@ function comment_form_alter(&$form, $for
 function comment_nodeapi(&$node, $op, $arg = 0) {
   switch ($op) {
     case 'load':
-      return db_fetch_array(db_query("SELECT last_comment_timestamp, last_comment_name, comment_count FROM {node_comment_statistics} WHERE nid = %d", $node->nid));
-      break;
+      if ($node->comment != COMMENT_NODE_DISABLED) {
+        return db_fetch_array(db_query("SELECT last_comment_timestamp, last_comment_name, comment_count FROM {node_comment_statistics} WHERE nid = %d", $node->nid));
+      }      
+      return array('last_comment_timestamp' => $node->created, 'last_comment_name' => '', 'commenet_count' => 0);
 
     case 'prepare':
       if (!isset($node->comment)) {
Index: modules/comment/comment.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.test,v
retrieving revision 1.6
diff -u -p -r1.6 comment.test
--- modules/comment/comment.test	9 Jun 2008 16:33:20 -0000	1.6
+++ modules/comment/comment.test	13 Jun 2008 08:32:41 -0000
@@ -68,11 +68,21 @@ class CommentTestCase extends DrupalWebT
     $this->drupalGet('comment/edit/' . $reply->id);
     $reply = $this->postComment(NULL, $this->randomName(), $this->randomName());
     $this->assertTrue($this->commentExists($reply, TRUE), t('Modified reply found.'));
+    
+    // Pager
+    $this->setCommentsPerPage(2);
+    $comment_new_page = $this->postComment($this->node, $this->randomName(), $this->randomName());
+    $this->drupalGet('node/' . $this->node->nid);
+    $this->assertTrue($this->commentExists($comment) && $this->commentExists($comment_new_page), t('Page one exists. %s')); 
+    $this->drupalGet('node/' . $this->node->nid, array('query' => 'page=1'));
+    $this->assertTrue($this->commentExists($reply, TRUE), t('Page two exists. %s'));    
+    $this->setCommentsPerPage(50);
 
     // Delete comment and make sure that reply is also removed.
     $this->drupalLogout();
     $this->drupalLogin($this->admin_user);
     $this->deleteComment($comment);
+    $this->deleteComment($comment_new_page);
 
     $this->drupalGet('node/' . $this->node->nid);
     $this->assertFalse($this->commentExists($comment), t('Comment not found.'));
@@ -294,7 +304,7 @@ class CommentTestCase extends DrupalWebT
       $regex .= $comment->comment . '(.*?)'; // Match comment.
       $regex .= '<\/div>/s'; // Dot matches newlines and ensure that match doesn't bleed outside comment div.
 
-      return preg_match($regex, $this->drupalGetContent());
+      return (boolean)preg_match($regex, $this->drupalGetContent());
     }
     else {
       return FALSE;
@@ -351,7 +361,17 @@ class CommentTestCase extends DrupalWebT
   function setCommentAnonymous($level) {
     $this->setCommentSettings('comment_anonymous', $level, 'Anonymous commenting set to level ' . $level . '.');
   }
-
+  
+  /**
+   * Set the default number of comments per page.
+   *
+   * @param integer $comments
+   *   Comments per page value.
+   */
+  function setCommentsPerPage($number) {
+    $this->setCommentSettings('comment_default_per_page', $number, 'Number of comments per page set to ' . $number .'.');
+  }
+  
   /**
    * Set comment setting for article content type.
    *
