Measurement of double-differential cross sections for top quark pair production in pp collisions at $\sqrts = 8$ $\,\text TeV$ and impact on parton distribution functions