/**
  * Returns a list of all the comments attached to this record.
  *
  * @return PaginatedList
  */
 public function Comments()
 {
     $order = Commenting::get_config_value($this->ownerBaseClass, 'order_comments_by');
     $list = new PaginatedList(Comment::get()->where(sprintf("ParentID = '%s' AND BaseClass = '%s'", $this->owner->ID, $this->ownerBaseClass))->sort($order));
     $list->setPageLength(Commenting::get_config_value($this->ownerBaseClass, 'comments_per_page'));
     $controller = Controller::curr();
     $list->setPageStart($controller->request->getVar("commentsstart" . $this->owner->ID));
     $list->setPaginationGetVar("commentsstart" . $this->owner->ID);
     $list->MoreThanOnePage();
     return $list;
 }
 public function testMoreThanOnePage()
 {
     $list = new PaginatedList(new ArrayList());
     $list->setPageLength(1);
     $list->setTotalItems(1);
     $this->assertFalse($list->MoreThanOnePage());
     $list->setTotalItems(2);
     $this->assertTrue($list->MoreThanOnePage());
     // Disable paging
     $list->setPageLength(0);
     $this->assertFalse($list->MoreThanOnePage());
 }