The Past Perfect is used to describe events that happened before another event in the past. It is constructed like the present perfect tense, except that "haben" or "sein" is in its simple past form, "hatte" or "war".
The Past Perfect is used in sentences such as these:
Lena had already lived in Poland for four weeks when she found an apartment.
Lena hatte schon vier Wochen in Polen gelebt, als sie eine Wohnung gefunden hat.
Before the dog turned old, he had always been very playful.
Bevor der Hund alt geworden ist, war er immer sehr verspielt gewesen.