--- site_map.module	2008-02-08 07:22:00.000000000 +0000
+++ site_map_new.module	2008-04-17 14:12:04.000000000 +0000
@@ -150,6 +150,12 @@ function site_map_admin_settings() {
     '#maxlength' => 10,
     '#description' => t('Specify how many subcategories should be included on the categorie page. Enter "all" to include all subcategories,"0" to include no subcategories, or "-1" not to append the depth at all.'),
   );
+  $form['site_map_content_options']['site_map_taxonomy_tree_page_increment'] = array(
+    '#type' => 'select',
+    '#title' => t('Select how many taxonomy terms to display per page'),
+    '#default_value' => variable_get('site_map_taxonomy_tree_page_increment', 0),
+    '#options' => array(0 => "ALL", 5 => "5", 100 => "100", 200 => "200", 500 => "500")
+  );
 
   $form['site_map_rss_options'] = array(
     '#type' => 'fieldset',
@@ -434,9 +440,12 @@ function _site_map_menu_tree($pid = 1, $
  * This function can be called from blocks or pages as desired.
  */
 function _site_map_taxonomys() {
+    
   if (module_exists('taxonomy') && $vids = variable_get('site_map_show_vocabularies', array())) {
+    
     $result = db_query('SELECT vid, name, description 
       FROM {vocabulary} WHERE vid IN (%s) ORDER BY weight ASC, name', implode(',', $vids));
+     
     while ($t = db_fetch_object($result)) {
       $output .= _site_map_taxonomy_tree($t->vid, $t->name, $t->description);
     }
@@ -454,6 +463,7 @@ function _site_map_taxonomys() {
  * @return A string representing a rendered tree.
  */
 function _site_map_taxonomy_tree($vid, $name = NULL, $description = NULL) {
+  
   if ($vid == variable_get('forum_nav_vocabulary', '')) {
     $title = l($name, 'forum');
   }
@@ -477,7 +487,36 @@ function _site_map_taxonomy_tree($vid, $
   $output .= '<div class="tree">';
   // taxonomy_get_tree() honors access controls
   $tree = taxonomy_get_tree($vid);
-  foreach ($tree as $term) {
+  
+  /**optional pager**/
+  $show_pager = false;
+  
+  $page_increment = variable_get("site_map_taxonomy_tree_page_increment", 0);
+ 
+  $total_entries = count($tree);
+  $display_count = $total_entries;
+  $current_page = 0; 
+  $start_from = 0;
+  if($page_increment > 0){
+    $show_pager = true;
+    
+    $current_page = $_GET['page'] ? $_GET['page'] : 0;
+        
+    $display_count = intval(($current_page + 1) * $page_increment);
+    
+    $start_from = $current_page * $page_increment;
+    
+    $display_count = ($display_count >= $total_entries)? $total_entries:$display_count;
+    
+    $GLOBALS['pager_page_array'][] = $current_page;
+    $GLOBALS['pager_total'][] = intval($total_entries / $page_increment) + 1;
+  }
+  
+  /**end optional pager**/
+  
+  for($pager_count = $start_from; $pager_count < $display_count; $pager_count++) {
+    
+    $term = $tree[$pager_count];
     // Adjust the depth of the <ul> based on the change
     // in $term->depth since the $last_depth.
     if ($term->depth > $last_depth) {
@@ -528,6 +567,10 @@ function _site_map_taxonomy_tree($vid, $
   $output .= "</div>\n";
   $output = theme('box', $title, $output);
 
+  if($show_pager === true){
+    $output .= theme('pager', NULL, $page_increment);
+  }
+    
   return $output;
 }
 
