added MySQLi version of the pagination