Index: trunk/ippMonitor/def/autocode.php
===================================================================
--- trunk/ippMonitor/def/autocode.php	(revision 34013)
+++ trunk/ippMonitor/def/autocode.php	(revision 34014)
@@ -29,4 +29,10 @@
 
 // Note: the restriction is now moved AFTER the count query
+// unless the RESTRICT_COUNT keyword is used
+if ($restricted == 0) {
+  if ("$RESTRICT_COUNT" != "none") {
+    $WHERE = "$WHERE $RESTRICT_COUNT";
+  }
+}
 
 // Add GROUP BY statements if any
@@ -55,5 +61,5 @@
 // Restrict the query if it is necessary
 if ($restricted == 0) {
-  if ("$UNRESTRICTED" != "none") {
+  if ( ("$UNRESTRICTED" != "none") && ("$RESTRICT_COUNT" == "none") ) {
     $WHERE = "$WHERE $UNRESTRICTED";
   }
Index: trunk/ippMonitor/def/rawBurntoolState.d
===================================================================
--- trunk/ippMonitor/def/rawBurntoolState.d	(revision 34013)
+++ trunk/ippMonitor/def/rawBurntoolState.d	(revision 34014)
@@ -5,4 +5,5 @@
 
 # if no query restrictions are supplied, we want to limit the query or it is extremely long running:
+RESTRICT_COUNT WHERE 0>1
 UNRESTRICTED WHERE exp_id = 0
 
Index: trunk/ippMonitor/scripts/generate
===================================================================
--- trunk/ippMonitor/scripts/generate	(revision 34013)
+++ trunk/ippMonitor/scripts/generate	(revision 34014)
@@ -29,4 +29,5 @@
     &init_key ("MODE");
     &init_key ("UNRESTRICTED");
+    &init_key ("RESTRICT_COUNT");
     &init_key ("TABLE");
     &init_key ("TITLE");
@@ -46,10 +47,10 @@
         if ($key eq "TABLE") { ($value) = $value =~ m|^\s*(.+)\s*$|; }
         if ($key eq "TYPE")  { ($value) = $value =~ m|^\s*(.+)\s*$|; }
-	if ($key eq "TOPLOT") { ($value) = $value =~ m|^\s*(.+)\s*$|; }
-	if ($key eq "PLOTTER") { ($value) = $value =~ m|^\s*(.+)\s*$|; }
-	if ($key eq "PLOTTITLE") { 
-	    ($value) = $value =~ m|^\s*(.+)\s*$|;
-	    $value =~ s/\s/_/g;
-	}
+        if ($key eq "TOPLOT") { ($value) = $value =~ m|^\s*(.+)\s*$|; }
+        if ($key eq "PLOTTER") { ($value) = $value =~ m|^\s*(.+)\s*$|; }
+        if ($key eq "PLOTTITLE") {
+            ($value) = $value =~ m|^\s*(.+)\s*$|;
+            $value =~ s/\s/_/g;
+        }
 
         &set_keypair ($key, $value);
@@ -61,16 +62,16 @@
             if ($field =~ m|\S+\s+as\s+\S+|) {
                 ($fieldreal) = $field =~ m|\S+\s+as\s+(\S+)|;
-		#print STDERR "Case 1\n";
+                #print STDERR "Case 1\n";
             } elsif ($field =~ m|\S+\s+AS\s+\S+|) {
-		#print STDERR "field=$field\n";
-		$fieldreal = $field;
-		$fieldreal =~ s/\s+AS.*$//;
+                #print STDERR "field=$field\n";
+                $fieldreal = $field;
+                $fieldreal =~ s/\s+AS.*$//;
                 #($fieldreal) = $field =~ m|\S+\s+as\s+(\S+)|;
-		#print STDERR "Case 2\n";
+                #print STDERR "Case 2\n";
             } else {
                 $fieldreal = $field;
-		#print STDERR "Case 3\n";
+                #print STDERR "Case 3\n";
             }
-	    #print STDERR "field=[$field]\tfieldreal=[$fieldreal]\n";
+            #print STDERR "field=[$field]\tfieldreal=[$fieldreal]\n";
 
             if ($VERBOSE) { printf "%-20s %-20s %-20s %-20s %-20s %-20s\n", $field, $name, $format, $show, $link, $extras; }
@@ -141,4 +142,5 @@
     &check_key ("MODE", "basic");
     &check_key ("UNRESTRICTED", "none");
+    &check_key ("RESTRICT_COUNT", "none");
     &check_key ("TABLE", "");
     &check_key ("TITLE", "");
@@ -324,5 +326,4 @@
 # generate a WHERE test for each field (field != *)
 sub write_table_restrict {
-
     if ($WHERE) {
         print FILE "\$WHERE = \"WHERE $WHERE\";\n";
@@ -348,5 +349,5 @@
 }
 
-# Generate GROUP BY statement if any 
+# Generate GROUP BY statement if any
 sub write_group_by {
     print FILE "\$WHERE = check_ordering ('$GROUPS', \$WHERE);\n";
@@ -536,7 +537,7 @@
     @extfields = split (/,/, $extras);
     for ($i = 0; $i < @extfields; $i++) {
-	# print STDERR $extfields[$i],"\n";
+        # print STDERR $extfields[$i],"\n";
         ($label, $value, $outline) = &parse_label ($extfields[$i]);
-	# print STDERR "[",$label,"]","[",$value,"]","[",$outline,"\n";
+        # print STDERR "[",$label,"]","[",$value,"]","[",$outline,"\n";
         print FILE "  \$link = \$link . \"&$outline\";\n";
     }
@@ -553,5 +554,5 @@
     # print STDERR "#############################\n";
     # foreach my $key ( keys %linkarg ) {
-    # 	print STDERR "key: $key, value: $linkarg{$key}\n";
+    #   print STDERR "key: $key, value: $linkarg{$key}\n";
     # }
 
@@ -560,8 +561,8 @@
 
     if ($linkarg{$word}) {
-	# print STDERR "Case 1\n";
+        # print STDERR "Case 1\n";
         $linkarg{$word} = "$linkarg{$word},$value";
     } else {
-	# print STDERR "Case 2\n";
+        # print STDERR "Case 2\n";
         $linkarg{$word} = $value;
     }
@@ -585,11 +586,11 @@
     # print STDERR "### parse_label ###\n";
     # for ($i = 0; $i < @field; $i++) {
-    # 	print STDERR "field[$i]=$field[$i]\n";
+    #   print STDERR "field[$i]=$field[$i]\n";
     # }
     # for ($i = 0; $i < @fieldreal; $i++) {
-    # 	print STDERR "fieldreal[$i]=$fieldreal[$i]\n";
+    #   print STDERR "fieldreal[$i]=$fieldreal[$i]\n";
     # }
     # for ($i = 0; $i < @count; $i++) {
-    # 	print STDERR "count[$i]=$count[$i]\n";
+    #   print STDERR "count[$i]=$count[$i]\n";
     # }
 
@@ -598,5 +599,5 @@
     if ($string =~ m|\S+=\S+|) {
         ($label, $value) = $string =~ m|(\S+)=(\S+)|;
-	# print STDERR "value=$value\n";
+        # print STDERR "value=$value\n";
         if ($value =~ m|^\$|) {
           MATCH_LABEL:
@@ -669,7 +670,7 @@
     $name   = &parse_fieldname ($name);
     if (exists $ops{$name}) {
-	#if OPx was defined, replace it by its value
-	$name = $ops{$name};
-	$name =~ s/\s+//g;
+        #if OPx was defined, replace it by its value
+        $name = $ops{$name};
+        $name =~ s/\s+//g;
     }
     $camera = &parse_fieldname ($camera);
