Blizzard has confirmed the pity timer (legendary + epic) to the chinese regulator. Though the statement offically only applies to China, players are generally in agreement that the pity timer exists globally.
Just out of curiosity, are your chances on getting a leg greater around the 40th pack or they are the same as the others but the 40th has a 100% chance?
By how they've calculated and blizzard stated, it's a scale. That is the chance goes up as you go to 40 (that is, you have a better chance at getting a legendary on the 38th pack than you do on the 1st pack) with 40 being the 100% mark. IIRC I think the 39th pack is suggested to be about 80% while the first pack is 5%.
Overall, it results in an average of 20 packs for a legendary, as told by Blizzard.