Index: wp-admin/includes/media.php
===================================================================
--- wp-admin/includes/media.php	(revision 14691)
+++ wp-admin/includes/media.php	(working copy)
@@ -1844,22 +1844,20 @@
  *
  * @param unknown_type $errors
  */
-function media_upload_library_form($errors) {
+function media_upload_library_form( $errors ) {
 	global $wpdb, $wp_query, $wp_locale, $type, $tab, $post_mime_types;
 
 	media_upload_header();
 
-	$post_id = intval($_REQUEST['post_id']);
+	$post_id = (int) $_REQUEST['post_id'];
 
-	$form_action_url = admin_url("media-upload.php?type=$type&tab=library&post_id=$post_id");
-	$form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type);
+	$form_action_url = admin_url( "media-upload.php?type=$type&tab=library&post_id=$post_id" );
+	$form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
 
-	$_GET['paged'] = isset( $_GET['paged'] ) ? intval($_GET['paged']) : 0;
-	if ( $_GET['paged'] < 1 )
-		$_GET['paged'] = 1;
-	$start = ( $_GET['paged'] - 1 ) * 10;
-	if ( $start < 1 )
-		$start = 0;
+	$_GET['paged'] = empty( $_GET['paged'] ) ? 0 : (int) $_GET['paged'];
+	$_GET['paged'] = max( 1, $_GET['paged'] );
+	$start         = ( $_GET['paged'] - 1 ) * 10;
+
 	add_filter( 'post_limits', create_function( '$a', "return 'LIMIT $start, 10';" ) );
 
 	list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query();
@@ -1869,7 +1867,7 @@
 <form id="filter" action="" method="get">
 <input type="hidden" name="type" value="<?php echo esc_attr( $type ); ?>" />
 <input type="hidden" name="tab" value="<?php echo esc_attr( $tab ); ?>" />
-<input type="hidden" name="post_id" value="<?php echo (int) $post_id; ?>" />
+<input type="hidden" name="post_id" value="<?php echo $post_id; ?>" />
 <input type="hidden" name="post_mime_type" value="<?php echo isset( $_GET['post_mime_type'] ) ? esc_attr( $_GET['post_mime_type'] ) : ''; ?>" />
 
 <p id="media-search" class="search-box">
