<!--- Set the number of records to display on each page. --->
<CFSET ONEACHPAGE = 20>
<!--- Set the default startrow to 1 if a value was not passed. --->
<!--- Determine whether or not to show the previous or next links. --->
<CFPARAM NAME = "StartRow" DEFAULT = "1">
<!--- Set the value of endrow to the maxrows + startrow - 1 --->
<CFSET ENDROW = STARTROW + ONEACHPAGE - 1>
<!--- If the end row is greater than the recordcount, determine how many records are left. --->
<CFIF ENDROW GTE GETDOCUMENTS.RECORDCOUNT>
<CFSET ENDROW = GETDOCUMENTS.RECORDCOUNT>
<CFSET NEXT = FALSE>
<!--- Otherwise, set Next to true and determine the next set of records. --->
<CFELSE>
<CFSET NEXT = TRUE>
<CFIF ENDROW + ONEACHPAGE GT GETDOCUMENTS.RECORDCOUNT>
<CFSET NEXTNUM = GETDOCUMENTS.RECORDCOUNT - ENDROW>
<CFELSE>
<CFSET NEXTNUM = ONEACHPAGE>
</CFIF>
<CFSET NEXTSTART = ENDROW + 1>
</CFIF>
<!--- If StartRow is 1, set Previous to false. --->
<CFIF STARTROW IS 1>
<CFSET PREVIOUS = FALSE>
<!--- Othewise, determine the previous set of records. --->
<CFELSE>
<CFSET PREVIOUS = TRUE>
<CFSET PREVIOUSSTART = STARTROW - ONEACHPAGE>
</CFIF>
<!--- Determine how many pages will be displayed. --->
<CFSET NUMPAGES = CEILING(GETDOCUMENTS.RECORDCOUNT / ONEACHPAGE)>
<CFPARAM NAME = "PageNum" DEFAULT = "1">