Makes sense to use MaxRows instead of a hard-coded value

This commit is contained in:
Marc Delisle
2010-12-19 05:49:38 -05:00
parent 386581bcb6
commit c3db2ade11

View File

@@ -21,7 +21,6 @@ require_once './libraries/header_http.inc.php';
/** /**
* Displays the frame * Displays the frame
*/ */
$per_page = 200;
require_once './libraries/transformations.lib.php'; // Transformations require_once './libraries/transformations.lib.php'; // Transformations
$cfgRelation = PMA_getRelationsParam(); $cfgRelation = PMA_getRelationsParam();
$foreigners = ($cfgRelation['relwork'] ? PMA_getForeigners($db, $table) : FALSE); $foreigners = ($cfgRelation['relwork'] ? PMA_getForeigners($db, $table) : FALSE);
@@ -32,7 +31,7 @@ if (!isset($pos)) {
$pos = 0; $pos = 0;
} }
$foreign_limit = 'LIMIT ' . $pos . ', ' . $per_page . ' '; $foreign_limit = 'LIMIT ' . $pos . ', ' . $GLOBALS['cfg']['MaxRows'] . ' ';
if (isset($foreign_navig) && $foreign_navig == __('Show all')) { if (isset($foreign_navig) && $foreign_navig == __('Show all')) {
unset($foreign_limit); unset($foreign_limit);
} }
@@ -53,15 +52,15 @@ $showall = '';
if (is_array($foreignData['disp_row'])) { if (is_array($foreignData['disp_row'])) {
if ($cfg['ShowAll'] && ($foreignData['the_total'] > $per_page)) { if ($cfg['ShowAll'] && ($foreignData['the_total'] > $GLOBALS['cfg']['MaxRows'])) {
$showall = '<input type="submit" name="foreign_navig" value="' . __('Show all') . '" />'; $showall = '<input type="submit" name="foreign_navig" value="' . __('Show all') . '" />';
} }
$session_max_rows = $per_page; $session_max_rows = $GLOBALS['cfg']['MaxRows'];
$pageNow = @floor($pos / $session_max_rows) + 1; $pageNow = @floor($pos / $session_max_rows) + 1;
$nbTotalPage = @ceil($foreignData['the_total'] / $session_max_rows); $nbTotalPage = @ceil($foreignData['the_total'] / $session_max_rows);
if ($foreignData['the_total'] > $per_page) { if ($foreignData['the_total'] > $GLOBALS['cfg']['MaxRows']) {
$gotopage = PMA_pageselector( $gotopage = PMA_pageselector(
'browse_foreigners.php?field=' . urlencode($field) . 'browse_foreigners.php?field=' . urlencode($field) .
'&amp;' . PMA_generate_common_url($db, $table) '&amp;' . PMA_generate_common_url($db, $table)