
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
deep-pagination
Advanced tools
Intelligent pagination generator with multi-level deep pages for SEO-friendly crawling
Intelligent pagination generator with multi-level deep pages, optimized for SEO-friendly crawling while maintaining excellent user experience.
…) to avoid showing too many consecutive pagesnpm install deep-pagination
# or
yarn add deep-pagination
# or
pnpm add deep-pagination
import deepPagination from 'deep-pagination';
const result = deepPagination({
current: 1250,
max: 50000
});
console.log(result.pages);
// Output: [1, 250, 500, 1000, "…", 1248, 1249, 1250, 1251, 1252, "…", 5000, 10000, 50000]
deepPagination(options: PaginationOptions): PaginationResultGenerates smart pagination with intelligent gap placement and multi-level navigation.
| Parameter | Type | Default | Description |
|---|---|---|---|
current | number | - | Current page number (1-based) Required |
max | number | - | Maximum number of pages Required |
pad | number | 2 | Number of additional pages to show around current page |
gapSymbol | string | '…' | Symbol used to represent gaps in pagination |
jumpValues | number[] | [50000, 25000, ...] | Custom jump values for multi-level pagination |
interface PaginationResult {
pages: (number | string)[]; // Array of page numbers and gap symbols
hasPrevious: boolean; // Whether there are pages before current
hasNext: boolean; // Whether there are pages after current
totalPages: number; // Total number of pages
currentPage: number; // Current page number
}
import deepPagination from 'deep-pagination';
// Simple pagination
const basic = deepPagination({
current: 5,
max: 100
});
console.log(basic.pages);
// [1, 2, 3, 4, 5, 6, 7, '…', 10, 11, 15, 20, 25, 50, 100]
// Handle large datasets with more context
const largePagination = deepPagination({
current: 15000,
max: 1000000,
pad: 3 // Show 3 pages on each side of current
});
console.log(largePagination.pages);
// [1, 3000, 4000, 5000, 10000, '…', 14997, 14998, 14999, 15000, 15001, 15002, 15003, '…', 20000, 30000, 50000, 100000, 1000000],
// E-commerce with custom jump pattern
const customJumps = deepPagination({
current: 250,
max: 10000,
jumpValues: [1000, 500, 100, 50, 25, 10, 5, 1]
});
console.log(customJumps.pages);
// [1, 50, 100, 200, '…', 248, 249, 250, 251, 252, '…', 300, 500, 1000, 10000],
// Automatically simplifies for small page counts
const simple = deepPagination({
current: 3,
max: 8
});
console.log(simple.pages);
// [1, 2, 3, 4, 5, 6, 7, 8] - No gaps needed
The library uses intelligent jump values optimized for various dataset sizes:
const DEFAULT_JUMP_VALUES = [50000, 25000, 10000, 5000, 1000, 500, 250, 100, 50, 25, 10, 5, 1];
const withCustomGap = deepPagination({
current: 50,
max: 1000,
gapSymbol: '...'
});
// Handle large product catalogs
const productPagination = deepPagination({
current: parseInt(searchParams.page) || 1,
max: Math.ceil(totalProducts / productsPerPage),
pad: 2
});
// Search engine result pages
const searchPagination = deepPagination({
current: currentPage,
max: Math.min(maxAllowedPages, totalResults / resultsPerPage),
jumpValues: [1000, 500, 100, 50, 25, 10, 5, 1]
});
// Blog post pagination with SEO optimization
const blogPagination = deepPagination({
current: page,
max: Math.ceil(totalPosts / postsPerPage),
pad: 1, // Minimal padding for cleaner look
jumpValues: [500, 250, 100, 50, 25, 10, 5, 1]
});
The library includes comprehensive input validation:
// Throws descriptive errors for invalid inputs
deepPagination({
current: 0, // Error: Current page must be a positive integer
max: -5 // Error: Max pages must be a positive integer
});
deepPagination({
current: 100,
max: 50 // Error: Current page cannot be greater than max pages
});
git checkout -b feature/amazing-feature)git commit -m 'Add some amazing feature')git push origin feature/amazing-feature)FAQs
Intelligent pagination generator with multi-level deep pages for SEO-friendly crawling
We found that deep-pagination demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.