<cfset min = page-Int(n/2)> <cfset max = page+Int(n/2)>
<cfif min LT 1> <cfset max = max - (min-1)> <cfset min = 1> </cfif>
<cfif max GT Ceiling(newarticle.recordcount/rowsPerPage)> <cfset min = min - (max - Ceiling(newarticle.recordcount/rowsPerPage))> <cfset max = Ceiling(newarticle.recordcount/rowsPerPage)> </cfif>
<cfset min = page-Int(n/2)> <cfset max = page+Int(n/2)>
<cfif min LT 1> <cfset max = max - (min-1)> <cfset min = 1> </cfif>
<cfif max GT Ceiling(newarticle.recordcount/rowsPerPage)> <cfset min = min - (max - Ceiling(newarticle.recordcount/rowsPerPage))> <cfset max = Ceiling(newarticle.recordcount/rowsPerPage)> </cfif>