I couldn't find the SQL statements for those two recordsets on any of the pages. However I see you are using the TotalRows property of the recordset to get the count, and that won't work because it is the number of rows in that recordset.
You probably have to adjust the SQL and use some nested SELECT Count() statements or even separate recordsets to get the row count inside the repeat region, which may be more efficient.