Does PI planning actually plan for only a few sprints ahead or does it plan for the whole project(all sprints until production)?
A "Program Increment" consists of a number of sprints. It's not the whole project; that would be contrary to the iterative nature of Agile.
In the page I linked, it says that a Program Increment is initiated by a PI Planning Session followed by four execution iterations. Then the process is repeated for the next PI.
However, it also states that there is no fixed rule for how many iterations actually go into a PI, but that an 8 to 12 week duration seems optimal.