Index: modules/taxonomy/taxonomy.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.module,v
retrieving revision 1.523
diff -u -p -r1.523 taxonomy.module
--- modules/taxonomy/taxonomy.module	16 Oct 2009 03:21:23 -0000	1.523
+++ modules/taxonomy/taxonomy.module	16 Oct 2009 14:55:58 -0000
@@ -88,29 +88,36 @@ function taxonomy_entity_info() {
  *   The term object.
  * @param $pager
  *   Boolean to indicate whether a pager should be used.
+ * @param $limit
+ *   Integer. The maximum number of nodes to find.
+ *   Set to -1 for no limit.
  * @order
  *   An array of fields and directions.
  *
  * @return
  *   An array of nids matching the query.
  */
-function taxonomy_select_nodes($term, $pager = TRUE, $order = array('t.sticky' => 'DESC', 't.created' => 'DESC')) {
+function taxonomy_select_nodes($term, $pager = TRUE, $limit = -1, $order = array('t.sticky' => 'DESC', 't.created' => 'DESC')) {
   if (!variable_get('taxonomy_maintain_index_table', TRUE)) {
     return array();
   }
+  $limit = (int) $limit;
   $query = db_select('taxonomy_index', 't');
   $query->addTag('node_access');
   if ($pager) {
     $count_query = clone $query;
     $count_query->addExpression('COUNT(t.nid)');
 
-    $query = $query
-      ->extend('PagerDefault')
-      ->limit(variable_get('default_nodes_main', 10));
+    $query = $query->extend('PagerDefault');
+    if ($limit >= 0) {
+      $query = $query->limit($limit);
+    }
     $query->setCountQuery($count_query);
   }
   else {
-    $query->range(0, variable_get('feed_default_items', 10));
+    if ($limit >= 0) {
+      $query->range(0, $limit);
+    }
   }
   $query->condition('tid', $term->tid );
   $query->addField('t', 'nid');
Index: modules/taxonomy/taxonomy.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.pages.inc,v
retrieving revision 1.40
diff -u -p -r1.40 taxonomy.pages.inc
--- modules/taxonomy/taxonomy.pages.inc	16 Oct 2009 03:21:23 -0000	1.40
+++ modules/taxonomy/taxonomy.pages.inc	16 Oct 2009 14:55:58 -0000
@@ -41,7 +41,7 @@ function taxonomy_term_page($term) {
       '#suffix' => '</div>',
     );
   }
-  if ($nids = taxonomy_select_nodes($term)) {
+  if ($nids = taxonomy_select_nodes($term, TRUE, variable_get('default_nodes_main', 10))) {
     $nodes = node_load_multiple($nids);
     $build += node_build_multiple($nodes);
     $build['pager'] = array(
@@ -71,7 +71,7 @@ function taxonomy_term_feed($term) {
   // Only display the description if we have a single term, to avoid clutter and confusion.
   // HTML will be removed from feed description, so no need to filter here.
   $channel['description'] = $term->description;
-  $nids = taxonomy_select_nodes(array($term->tid, FALSE));
+  $nids = taxonomy_select_nodes($term, FALSE, variable_get('feed_default_items', 10));
 
   node_feed($nids, $channel);
 }
