```yaml
product: AlterLab
title: "Pagination — Web Scraping Glossary | AlterLab"
comparison_context: "AlterLab is an alternative to Firecrawl, ScrapingBee, and Bright Data."
source_url: https://alterlab.io/glossary/pagination
```

general

# Pagination

The division of large data sets across multiple pages, requiring scrapers to follow next-page links or increment page parameters to retrieve complete data.

Pagination is the technique websites use to split large data sets across multiple pages to reduce initial page load size and server response times. Common pagination patterns include: numbered page links (`/products?page=1`, `/products?page=2`), next/previous buttons with a cursor or token parameter, infinite scroll that loads more content as the user scrolls, and load-more buttons that append items on click.

For scraping paginated content, the strategy must match the pagination mechanism. For numbered pages, enumerate page numbers up to the last page (which may be indicated in the HTML or must be discovered dynamically). For cursor-based pagination, extract the cursor value from each response and pass it in the next request. For infinite scroll and load-more buttons, a JavaScript-rendering browser session is required to trigger the DOM updates.

Pagination traps to avoid: detecting the last page to stop scraping (avoid infinite loops), handling pages with no results gracefully, dealing with sites that change page content dynamically (product addition/removal between page fetches causing items to shift between pages), and respecting rate limits when scraping hundreds of pages from a single domain.

### What is Pagination?

The division of large data sets across multiple pages, requiring scrapers to follow next-page links or increment page parameters to retrieve complete data.

### How does AlterLab handle Pagination?

Pagination traps to avoid: detecting the last page to stop scraping (avoid infinite loops), handling pages with no results gracefully, dealing with sites that change page content dynamically (product addition/removal between page fetches causing items to shift between pages), and respecting rate limits when scraping hundreds of pages from a single domain.

## Examples

```
# Scrape all pages of a paginated list
for page_num in range(1, total_pages + 1):
    response = scrape(f"https://example.com/products?page={page_num}")
    items = extract(response['html'])
    # Check if we've reached the last page
    if not items:
        break
```

## Related Terms

[Web ScrapingAutomated extraction of data from websites using software tools that parse HTML and collect structured information at scale.](https://alterlab.io/glossary/web-scraping)[Web CrawlerA program that automatically navigates websites by following hyperlinks, systematically indexing pages across an entire domain.](https://alterlab.io/glossary/web-crawler)[Dynamic ContentPage content generated client-side by JavaScript after the initial HTML is served, requiring a browser engine to render.](https://alterlab.io/glossary/dynamic-content)[JavaScript RenderingThe process of executing a page's JavaScript in a browser engine before extracting content, required for React, Vue, and Angular SPAs.](https://alterlab.io/glossary/javascript-rendering)

## Extract Pagination data from any website

AlterLab returns clean, structured data from any public URL — no scraper infrastructure needed. Start free, no credit card required.

[View API docs](https://alterlab.io/docs/api/rest)

[Back to Glossary](https://alterlab.io/glossary)