Index: src/report.c
==================================================================
--- src/report.c
+++ src/report.c
@@ -954,12 +954,12 @@
 **       n      Sort numerically
 **       k      Sort by the data-sortkey property
 **       x      This column is not sortable
 **
 ** Capital letters mean sort in reverse order.
-** If there are fewer characters in zColumnTypes[] than their are columns,
-** the all extra columns assume type "t" (text).
+** If there are fewer characters in zColumnTypes[] than there are columns,
+** the extra columns assume type "t" (text).
 **
 ** The third parameter is the column that was initially sorted (using 1-based
 ** column numbers, like SQL).  Make this value 0 if none of the columns are
 ** initially sorted.  Make the value negative if the column is initially sorted
 ** in reverse order.
@@ -973,10 +973,12 @@
 ){
   @ <script>
   @ function SortableTable(tableEl,columnTypes,initSort){
   @   this.tbody = tableEl.getElementsByTagName('tbody');
   @   this.columnTypes = columnTypes;
+  @   var cols = tableEl.rows[0].cells.length;
+  @   for (var i = columnTypes.length; i <= cols; ++i) this.columnTypes += 't';
   @   this.sort = function (cell) {
   @     var column = cell.cellIndex;
   @     var sortFn;
   @     switch( cell.sortType ){
   if( strchr(zColumnTypes,'n') ){
@@ -983,13 +985,12 @@
     @       case "n": sortFn = this.sortNumeric;  break;
   }
   if( strchr(zColumnTypes,'N') ){
     @       case "N": sortFn = this.sortReverseNumeric;  break;
   }
-  if( strchr(zColumnTypes,'t') ){
-    @       case "t": sortFn = this.sortText;  break;
-  }
+  /* this case is always present; see function contract above! */
+  @       case "t": sortFn = this.sortText;  break;
   if( strchr(zColumnTypes,'T') ){
     @       case "T": sortFn = this.sortReverseText;  break;
   }
   if( strchr(zColumnTypes,'k') ){
     @       case "k": sortFn = this.sortKey;  break;
@@ -1031,20 +1032,19 @@
   @       var clsName = hdrCell.className.replace(/\s*\bsort\s*\w+/, '');
   @       clsName += ' sort ' + sortType;
   @       hdrCell.className = clsName;
   @     }
   @   }
-  if( strchr(zColumnTypes,'t') ){
-    @   this.sortText = function(a,b) {
-    @     var i = thisObject.sortIndex;
-    @     aa = a.cells[i].textContent.replace(/^\W+/,'').toLowerCase();
-    @     bb = b.cells[i].textContent.replace(/^\W+/,'').toLowerCase();
-    @     if(aa<bb) return -1;
-    @     if(aa==bb) return a.rowIndex-b.rowIndex;
-    @     return 1;
-    @   }
-  }
+  /* this sorting method is always available; see case "t" above */
+  @   this.sortText = function(a,b) {
+  @     var i = thisObject.sortIndex;
+  @     aa = a.cells[i].textContent.replace(/^\W+/,'').toLowerCase();
+  @     bb = b.cells[i].textContent.replace(/^\W+/,'').toLowerCase();
+  @     if(aa<bb) return -1;
+  @     if(aa==bb) return a.rowIndex-b.rowIndex;
+  @     return 1;
+  @   }
   if( strchr(zColumnTypes,'T') ){
     @   this.sortReverseText = function(a,b) {
     @     var i = thisObject.sortIndex;
     @     aa = a.cells[i].textContent.replace(/^\W+/,'').toLowerCase();
     @     bb = b.cells[i].textContent.replace(/^\W+/,'').toLowerCase();

