From 4dd2226ef2bd8658d13147e66a2e0dbbbedb1976 Mon Sep 17 00:00:00 2001 From: Dan Ungureanu Date: Tue, 9 May 2017 23:23:57 +0300 Subject: [PATCH] Redirect user to last page that has any tables to display. Fixes #13241. Signed-off-by: Dan Ungureanu --- ChangeLog | 1 + .../database/DatabaseStructureController.php | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/ChangeLog b/ChangeLog index 039f89ccf0..825b2d505f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -22,6 +22,7 @@ phpMyAdmin - ChangeLog - issue #13256 Fixed password check on server replication - issue #13252 Fixed grid editing time column - issue #13258 Fixed detection of Amazon RDS +- issue #13241 Redirect user to last page that has any tables to display 4.7.0 (2017-03-28) - patch #12233 [Display] Improve message when renaming database to same name diff --git a/libraries/controllers/database/DatabaseStructureController.php b/libraries/controllers/database/DatabaseStructureController.php index 7184742412..47543a5f4f 100644 --- a/libraries/controllers/database/DatabaseStructureController.php +++ b/libraries/controllers/database/DatabaseStructureController.php @@ -146,6 +146,18 @@ class DatabaseStructureController extends DatabaseController // Gets the database structure $this->_getDbInfo('_structure'); + // Checks if there are any tables to be shown on current page. + // If there are no tables, the user is redirected to the last page + // having any. + if ($this->_total_num_tables > 0 && $this->_pos > $this->_total_num_tables) { + $uri = './db_structure.php' . URL::getCommonRaw(array( + 'db' => $this->db, + 'pos' => max(0, $this->_total_num_tables - $GLOBALS['cfg']['MaxTableList']), + 'reload' => 1 + )); + PMA_sendHeaderLocation($uri); + } + include_once 'libraries/replication.inc.php'; PageSettings::showGroup('DbStructure');