Furrytoebean is correct and the link provided enables you to check your national insurance record and obtain a state pension forecast. You only have 6 years to fill in gaps, unless you have a very good excuse for not having done it in time.
For the year to count for pension purposes you have to have earnings above the annual lower earnings limit. This can help people with irregular earnings as the year can count even if you only work 2-3 months of the year but meet the earnings limit.
Conversely if you are self employed or work regularly but only just around the weekly lower earnings limit and miss a week, everything else paid for the year doesn't count. The record will show if you get credits or built up home responsibilities protection to help the year count.
It is therefore important to check your record, as HMRC used to write if your record was deficient but they no longer do this.
There is currently a statutory formula linking the lower earnings limit and upper, but some contributors have highlighted that it is important to track these and that you fall within these limits and check the details of the government's proposals. They could break that link and take more people out of building up a pension, which you can currently do without paying any NI
Also remember that national insurance is used now to pay benefits and pensions now, so your "pot" isn't invested for your future, like your private pension funds are. Approx 20% of total NI paid goes to the NHS, the rest to benefits and pensions, and the shortfall is covered by general taxation. Crucially it doesn't technically cover social care and this is where the real existential crisis for the UK and first world countries is growing.