Validate pagination input. Props batmoo. See #15580

git-svn-id: http://svn.automattic.com/wordpress/trunk@16644 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
scribu
2010-12-01 06:02:19 +00:00
parent a0bc51f8d8
commit 2d2dea8fa2
3 changed files with 8 additions and 5 deletions

View File

@@ -149,8 +149,11 @@ listTable.init();
// Ajaxify various UI elements
function change_page(paged, $el) {
if ( paged < 1 || paged > listTable.get_total_pages() )
return false;
if ( paged < 1 )
paged = 1;
if ( paged > listTable.get_total_pages() )
paged = listTable.get_total_pages();
listTable.update_rows({'paged': paged}, false, function() {
if ( $el.parents('.tablenav.bottom').length )
@@ -189,7 +192,7 @@ listTable.init();
var $el = $(this);
change_page(parseInt($el.val()), $el);
change_page(parseInt($el.val()) || 1, $el);
return false;
});