It’s about the use of “Present Perfect” and “Past Perfect” verb tenses.
Present Perfect is used to say that an action happened at an unspecified time before now, but the exact time is not important. (Note: if you want to say the exact time of the past action, then use “Past simple” tense).
Example:
I have had an accident in my life. (the exact date of the accident is not important)
I had an accident in 2008. (the exact date of the accident is important)
Past Perfect is used to express that a past action (let’s call it “past action 1”) happened before another past action (let’s call it “past action 2”). Instead of past action 2 you can also use a past date. The exact time of past action 1 is not important.
Example:
Last night was not the first time she had a headache (past action 2), she had had a headache several times before (past action 1).
She had never had a headache (past action 1) before last time (we use past date instead of past action 2).