Index: wp-includes/taxonomy.php
===================================================================
--- wp-includes/taxonomy.php	(revision 13459)
+++ wp-includes/taxonomy.php	(working copy)
@@ -748,6 +748,7 @@
 		$args['hierarchical'] = false;
 		$args['pad_counts'] = false;
 	}
+
 	extract($args, EXTR_SKIP);
 
 	if ( $child_of ) {
@@ -871,16 +872,29 @@
 	}
 
 	$selects = array();
-	if ( 'all' == $fields )
-		$selects = array('t.*', 'tt.*');
-	else if ( 'ids' == $fields || 'id=>parent' == $fields )
-		$selects = array('t.term_id', 'tt.parent', 'tt.count');
-	else if ( 'names' == $fields )
-		$selects = array('t.term_id', 'tt.parent', 'tt.count', 't.name');
+	switch ( $fields ) {
+ 		case 'all':
+ 			$selects = array('t.*', 'tt.*');
+ 			break;
+ 		case 'ids':
+		case 'id=>parent':
+ 			$selects = array('t.term_id', 'tt.parent', 'tt.count');
+ 			break;
+ 		case 'names':
+ 			$selects = array('t.term_id', 'tt.parent', 'tt.count', 't.name');
+ 			break;
+ 		case 'count':
+ 			$selects = array('COUNT(*)');
+ 	}
     $select_this = implode(', ', apply_filters( 'get_terms_fields', $selects, $args ));
 
 	$query = "SELECT $select_this FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ($in_taxonomies) $where ORDER BY $orderby $order $limit";
 
+	if ( 'count' == $fields ) {
+		$term_count = $wpdb->get_var($query);
+ 		return $term_count;
+ 	}
+
 	$terms = $wpdb->get_results($query);
 	if ( 'all' == $fields ) {
 		update_term_cache($terms);
@@ -1130,32 +1144,32 @@
 /**
  * Count how many terms are in Taxonomy.
  *
- * Default $args is 'ignore_empty' which can be <code>'ignore_empty=true'</code>
- * or <code>array('ignore_empty' => true);</code>.
+ * Default $args is 'hide_empty' which can be 'hide_empty=true' or array('hide_empty' => true).
  *
  * @package WordPress
  * @subpackage Taxonomy
  * @since 2.3.0
  *
- * @uses $wpdb
+ * @uses get_terms()
  * @uses wp_parse_args() Turns strings into arrays and merges defaults into an array.
  *
  * @param string $taxonomy Taxonomy name
- * @param array|string $args Overwrite defaults
+ * @param array|string $args Overwrite defaults. See get_terms()
  * @return int How many terms are in $taxonomy
  */
 function wp_count_terms( $taxonomy, $args = array() ) {
-	global $wpdb;
-
-	$defaults = array('ignore_empty' => false);
+	$defaults = array('hide_empty' => false);
 	$args = wp_parse_args($args, $defaults);
-	extract($args, EXTR_SKIP);
 
-	$where = '';
-	if ( $ignore_empty )
-		$where = 'AND count > 0';
+	// backwards compatibility
+	if ( isset($args['ignore_empty']) ) {
+		$args['hide_empty'] = $args['ignore_empty'];
+		unset($args['ignore_empty']);
+	}
 
-	return $wpdb->get_var( $wpdb->prepare("SELECT COUNT(*) FROM $wpdb->term_taxonomy WHERE taxonomy = %s $where", $taxonomy) );
+	$args['fields'] = 'count';
+
+	return get_terms($taxonomy, $args);
 }
 
 /**
Index: wp-admin/edit-tags.php
===================================================================
--- wp-admin/edit-tags.php	(revision 13459)
+++ wp-admin/edit-tags.php	(working copy)
@@ -230,20 +230,17 @@
 	$tags_per_page = apply_filters( 'edit_' . $taxonomy . '_per_page', $tags_per_page );
 }
 
-if ( !empty($_GET['s']) ) {
+if ( !empty($_GET['s']) )
 	$searchterms = trim(stripslashes($_GET['s']));
-	$total_terms = count( get_terms( $taxonomy, array( 'search' => $searchterms, 'number' => 0, 'hide_empty' => 0 ) ) );
-} else {
+else
 	$searchterms = '';
-	$total_terms = wp_count_terms($taxonomy);
-}
 
 $page_links = paginate_links( array(
 	'base' => add_query_arg( 'pagenum', '%#%' ),
 	'format' => '',
 	'prev_text' => __('&laquo;'),
 	'next_text' => __('&raquo;'),
-	'total' => ceil($total_terms / $tags_per_page),
+	'total' => ceil(wp_count_terms($taxonomy, array('search' => $searchterms)) / $tags_per_page),
 	'current' => $pagenum
 ));
 
@@ -409,4 +406,4 @@
 
 include('admin-footer.php');
 
-?>
\ No newline at end of file
+?>
