Pakistan has been here before, and the last time, it barely escaped.