? .komodotools ? drupal_7_head.komodoproject ? sites/default/files ? sites/default/settings.php Index: includes/pager.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/pager.inc,v retrieving revision 1.86 diff -u -p -r1.86 pager.inc --- includes/pager.inc 14 Nov 2010 22:07:57 -0000 1.86 +++ includes/pager.inc 20 Dec 2010 19:54:18 -0000 @@ -189,8 +189,10 @@ function pager_find_page($element = 0) { $page = isset($_GET['page']) ? $_GET['page'] : ''; $page_array = explode(',', $page); if (!isset($page_array[$element])) { - $page_array[$element] = 0; + $page_array[$element] = 1; } + // Translate human readable page numbers to PHP offset logic. + $page_array[$element]--; return (int) $page_array[$element]; } @@ -593,7 +595,8 @@ function theme_pager_link($variables) { $page = isset($_GET['page']) ? $_GET['page'] : ''; if ($new_page = implode(',', pager_load_array($page_new[$element], $element, explode(',', $page)))) { - $parameters['page'] = $new_page; + // Translate PHP offset logic to human readable page numbers. + $parameters['page'] = $new_page + 1; } $query = array(); Index: modules/comment/comment.module =================================================================== RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v retrieving revision 1.929 diff -u -p -r1.929 comment.module --- modules/comment/comment.module 18 Dec 2010 01:50:15 -0000 1.929 +++ modules/comment/comment.module 20 Dec 2010 19:54:19 -0000 @@ -1803,7 +1803,7 @@ function comment_get_display_ordinal($ci function comment_get_display_page($cid, $node_type) { $ordinal = comment_get_display_ordinal($cid, $node_type); $comments_per_page = variable_get('comment_default_per_page_' . $node_type, 50); - return floor($ordinal / $comments_per_page); + return floor($ordinal / $comments_per_page) + 1; } /** Index: modules/comment/comment.test =================================================================== RCS file: /cvs/drupal/drupal/modules/comment/comment.test,v retrieving revision 1.96 diff -u -p -r1.96 comment.test --- modules/comment/comment.test 18 Dec 2010 01:50:16 -0000 1.96 +++ modules/comment/comment.test 20 Dec 2010 19:54:19 -0000 @@ -339,7 +339,7 @@ class CommentInterfaceTest extends Comme $this->setCommentsPerPage(2); $comment_new_page = $this->postComment($this->node, $this->randomName(), $this->randomName(), TRUE); $this->assertTrue($this->commentExists($comment_new_page), t('Page one exists. %s')); - $this->drupalGet('node/' . $this->node->nid, array('query' => array('page' => 1))); + $this->drupalGet('node/' . $this->node->nid, array('query' => array('page' => 2))); $this->assertTrue($this->commentExists($reply, TRUE), t('Page two exists. %s')); $this->setCommentsPerPage(50); @@ -736,13 +736,13 @@ class CommentPagerTest extends CommentHe $this->assertFalse($this->commentExists($comments[2]), t('Comment 3 does not appear on page 1.')); // Check the second page. - $this->drupalGet('node/' . $node->nid, array('query' => array('page' => 1))); + $this->drupalGet('node/' . $node->nid, array('query' => array('page' => 2))); $this->assertTrue($this->commentExists($comments[1]), t('Comment 2 appears on page 2.')); $this->assertFalse($this->commentExists($comments[0]), t('Comment 1 does not appear on page 2.')); $this->assertFalse($this->commentExists($comments[2]), t('Comment 3 does not appear on page 2.')); // Check the third page. - $this->drupalGet('node/' . $node->nid, array('query' => array('page' => 2))); + $this->drupalGet('node/' . $node->nid, array('query' => array('page' => 3))); $this->assertTrue($this->commentExists($comments[2]), t('Comment 3 appears on page 3.')); $this->assertFalse($this->commentExists($comments[0]), t('Comment 1 does not appear on page 3.')); $this->assertFalse($this->commentExists($comments[1]), t('Comment 2 does not appear on page 3.')); Index: modules/search/search.test =================================================================== RCS file: /cvs/drupal/drupal/modules/search/search.test,v retrieving revision 1.85 diff -u -p -r1.85 search.test --- modules/search/search.test 6 Dec 2010 07:00:30 -0000 1.85 +++ modules/search/search.test 20 Dec 2010 19:54:20 -0000 @@ -446,7 +446,7 @@ class SearchRankingTestCase extends Drup function testHTMLRankings() { // Login with sufficient privileges. $this->drupalLogin($this->drupalCreateUser(array('create page content'))); - + // Test HTML tags with different weights. $sorted_tags = array('h1', 'h2', 'h3', 'h4', 'a', 'h5', 'h6', 'notag'); $shuffled_tags = $sorted_tags; @@ -478,7 +478,7 @@ class SearchRankingTestCase extends Drup // Refresh variables after the treatment. $this->refreshVariables(); - + // Disable all other rankings. $node_ranks = array('sticky', 'promote', 'recent', 'comments', 'views'); foreach ($node_ranks as $node_rank) { @@ -516,7 +516,7 @@ class SearchRankingTestCase extends Drup // Assert the results. $this->assertEqual($set[0]['node']->nid, $node->nid, 'Search tag ranking for "<' . $tag . '>" order.'); - + // Delete node so it doesn't show up in subsequent search results. node_delete($node->nid); } @@ -687,16 +687,16 @@ class SearchExactTestCase extends Drupal // Test that the correct number of pager links are found for keyword search. $edit = array('keys' => 'love pizza'); $this->drupalPost('search/node', $edit, t('Search')); - $this->assertLinkByHref('page=1', 0, '2nd page link is found for keyword search.'); - $this->assertLinkByHref('page=2', 0, '3rd page link is found for keyword search.'); - $this->assertLinkByHref('page=3', 0, '4th page link is found for keyword search.'); - $this->assertNoLinkByHref('page=4', '5th page link is not found for keyword search.'); + $this->assertLinkByHref('page=2', 0, '2nd page link is found for keyword search.'); + $this->assertLinkByHref('page=3', 0, '3rd page link is found for keyword search.'); + $this->assertLinkByHref('page=4', 0, '4th page link is found for keyword search.'); + $this->assertNoLinkByHref('page=5', '5th page link is not found for keyword search.'); // Test that the correct number of pager links are found for exact phrase search. $edit = array('keys' => '"love pizza"'); $this->drupalPost('search/node', $edit, t('Search')); - $this->assertLinkByHref('page=1', 0, '2nd page link is found for exact phrase search.'); - $this->assertNoLinkByHref('page=2', '3rd page link is not found for exact phrase search.'); + $this->assertLinkByHref('page=2', 0, '2nd page link is found for exact phrase search.'); + $this->assertNoLinkByHref('page=3', '3rd page link is not found for exact phrase search.'); } } @@ -857,7 +857,7 @@ class SearchCommentTestCase extends Drup $this->setRolePermissions(DRUPAL_AUTHENTICATED_RID, TRUE, TRUE); $this->setRolePermissions($this->admin_role, TRUE, FALSE); $this->checkCommentAccess('Admin user has access comments permission and no search permission, but comments should be indexed because admin user inherits authenticated user\'s permission to search', TRUE); - + } /** Index: modules/simpletest/tests/database_test.test =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/tests/database_test.test,v retrieving revision 1.105 diff -u -p -r1.105 database_test.test --- modules/simpletest/tests/database_test.test 15 Dec 2010 06:52:54 -0000 1.105 +++ modules/simpletest/tests/database_test.test 20 Dec 2010 19:54:21 -0000 @@ -2152,19 +2152,14 @@ class DatabaseSelectPagerDefaultTestCase $count = db_query('SELECT COUNT(*) FROM {test_task}')->fetchField(); $correct_number = $limit; - $num_pages = floor($count / $limit); + $num_pages = ceil($count / $limit); - // If there is no remainder from rounding, subtract 1 since we index from 0. - if (!($num_pages * $limit < $count)) { - $num_pages--; - } - - for ($page = 0; $page <= $num_pages; ++$page) { + for ($page = 1; $page <= $num_pages; ++$page) { $this->drupalGet('database_test/pager_query_odd/' . $limit, array('query' => array('page' => $page))); $data = json_decode($this->drupalGetContent()); if ($page == $num_pages) { - $correct_number = $count - ($limit * $page); + $correct_number = $count - ($limit * ($page - 1)); } $this->assertEqual(count($data->names), $correct_number, t('Correct number of records returned by pager: @number', array('@number' => $correct_number))); @@ -2216,7 +2211,7 @@ class DatabaseSelectPagerDefaultTestCase * Confirm that every pager gets a valid non-overlaping element ID. */ function testElementNumbers() { - $_GET['page'] = '3, 2, 1, 0'; + $_GET['page'] = '4, 3, 2, 1'; $name = db_select('test', 't')->extend('PagerDefault') ->element(2) Index: modules/simpletest/tests/entity_query.test =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/tests/entity_query.test,v retrieving revision 1.15 diff -u -p -r1.15 entity_query.test --- modules/simpletest/tests/entity_query.test 14 Nov 2010 22:07:57 -0000 1.15 +++ modules/simpletest/tests/entity_query.test 20 Dec 2010 19:54:22 -0000 @@ -1109,7 +1109,7 @@ class EntityFieldQueryTestCase extends D */ function testEntityFieldQueryPager() { // Test pager in propertyQuery - $_GET['page'] = '0,1'; + $_GET['page'] = '1,2'; $query = new EntityFieldQuery(); $query ->entityCondition('entity_type', 'test_entity_bundle_key') @@ -1133,7 +1133,7 @@ class EntityFieldQueryTestCase extends D ), t('Test pager integration in propertyQuery: page 2.'), TRUE); // Test pager in field storage - $_GET['page'] = '0,1'; + $_GET['page'] = '1,2'; $query = new EntityFieldQuery(); $query ->entityCondition('entity_type', 'test_entity_bundle_key')