Pakistan, who have lost 13 of their last 18 tests, struggled in the difficult batting conditions and were dismissed for just 171.