Index: class-plugin-directory.php
===================================================================
--- class-plugin-directory.php	(revision 5266)
+++ class-plugin-directory.php	(working copy)
@@ -33,6 +33,7 @@
 		add_filter( 'post_type_link', array( $this, 'filter_post_type_link' ), 10, 2 );
 		add_filter( 'term_link', array( $this, 'filter_term_link' ), 10, 2 );
 		add_action( 'pre_get_posts', array( $this, 'pre_get_posts' ) );
+		add_filter( 'found_posts', array( $this, 'filter_found_posts' ), 10, 2 );
 		add_filter( 'rest_api_allowed_post_types', array( $this, 'filter_allowed_post_types' ) );
 		add_filter( 'pre_update_option_jetpack_options', array( $this, 'filter_jetpack_options' ) );
 		add_action( 'template_redirect', array( $this, 'prevent_canonical_for_plugins' ), 9 );
@@ -803,6 +804,16 @@
 	}
 
 	/**
+	 * Filter to limit the total number of found posts in browse queries.
+	 * Stops search crawlers from paginating through the entire DB.
+	 */
+	public function filter_found_posts( $found_posts, $wp_query ) {
+		if ( isset( $wp_query->query['browse'] ) && in_array( 'plugin', $wp_query->query_vars['post_type'] ) )
+			return min( $found_posts, 200 * $wp_query->query_vars['posts_per_page'] ); // 200 pages
+		return $found_posts;
+	}
+
+	/**
 	 * Filter to bypass caching for options critical to Jetpack sync to work around race conditions and other unidentified bugs.
 	 * If this works and becomes a permanent solution, it probably belongs elsewhere.
 	 */
