Paginate阵列的组合不会提前产生整个组合

I have the following loop that combines two arrays and displays the results in an ordered list:

$list1 = array("make","break","buy");
$list2 = array("home","car","bike");

echo "<ol>";
for($a=0; $a<3; $a++){
    for($b=0; $b<3; $b++){
        echo "<li".($list1[$a].$list2[$b])."</li>";
    }
}
echo "</ol>";

The actual arrays that I have include about 1500 words each, so the list is more than 2 Million combinations long.

Is there a way to display the results with pagination, without generating the entire result set in advance? For example 500 items per page?

FYI, I don't necessarily need to display the results in an ordered list, if that's going to mess up the pagination.

First, you'll need to be able to start looping from any position in the arrays.
Of course you can use for loops, but I think while loops fit better here.

$length1 = count($list1);
$length2 = count($list2);

//now indexes are initialized to variable values
$a = $var1; //start position $var1 is an integer variable between 0 and ($length1 - 1)
$b = $var2; //start position $var2 is an integer variable between 0 and ($length2 - 1)

while ($a < $length1) {
    while ($b < $length2) {
        echo '<li>', $list1[$a], ' ', $list2[$b], '</li>';
        $b++;
    }
    $b = 0; //reset inner loop each time it ends
    $a++;
}

Next, we need a way to stop both loops if the maximum number of results per page ($limit) is reached before the end of the combinations.

$length1 = count($list1);
$length2 = count($list2);
$a = $var1;
$b = $var2;

$counter = 0;

while ($a < $length1) {
    while ($b < $length2) {
        echo '<li>', $list1[$a], ' ', $list2[$b], '</li>';

        $counter++;
        if($counter === $limit) break 2;

        $b++;
    }
    $b = 0;
    $a++;
}

Finally, we must find the correct values for $var1 and $var2 above, based on the current $page (starting from page 1) and $limit. This is plain arithmetics that I won't explain here.
Putting it all together:

$length1 = count($list1);
$length2 = count($list2);

$offset = $limit * ($page - 1);
$a = (int)($offset / $length2);
$b = $offset % $length2;

$counter = 0;
while ($a < $length1) {
    while ($b < $length2) {
        echo '<li>', $list1[$a], ' ', $list2[$b], '</li>';
        $counter++;
        if($counter === $limit) break 2;
        $b++;
    }
    $b = 0;
    $a++;
}