first and last pages added for pagination