<participant>
     <quickSearch><![CDATA[_total]]></quickSearch>
     <insertText location="aboveHTML+75">
<![CDATA[
<%
' *** Recordset Stats: if we don't know the record count, manually count them

If (@@rsName@@_total = -1) Then

  ' count the total records by iterating through the recordset
  @@rsName@@_total=0
  While (Not @@rsName@@.EOF)
    @@rsName@@_total = @@rsName@@_total + 1
    @@rsName@@.MoveNext
  Wend

  ' reset the cursor to the beginning
  If (@@rsName@@.CursorType > 0) Then
    @@rsName@@.MoveFirst
  Else
    @@rsName@@.Requery
  End If

  ' set the number of rows displayed on this page
  If (@@rsName@@_numRows < 0 Or @@rsName@@_numRows > @@rsName@@_total) Then
    @@rsName@@_numRows = @@rsName@@_total
  End If

  ' set the first and last displayed record
  @@rsName@@_first = 1
  @@rsName@@_last = @@rsName@@_first + @@rsName@@_numRows - 1
  
  If (@@rsName@@_first > @@rsName@@_total) Then
    @@rsName@@_first = @@rsName@@_total
  End If
  If (@@rsName@@_last > @@rsName@@_total) Then
    @@rsName@@_last = @@rsName@@_total
  End If

End If
%>
]]>
     </insertText>
     <searchPatterns whereToSearch="directive">
       <searchPattern paramNames="rsName"><![CDATA[/\b(\w+)_total\s*=\s*\w+_total\s*\+\s*1/]]></searchPattern>
     </searchPatterns>
     <updatePatterns>
       <updatePattern paramName="rsName"><![CDATA[/(\W)\w+(_total|_numRows|_first|_last|\.EOF|\.MoveNext|\.MoveFirst|\.CursorType|\.Requery)/g]]></updatePattern>
     </updatePatterns>
</participant>
