Well, I just came back from doing a bunch of research in which I expected to find evolutionary reasons for a preference for long legs. Boy, was I surprised. It seems that the whole premise is wrong. Men might prefer longer legs in women, but the preference is only 5% (sorry, I didn’t keep track of my references). The preference is affected by culture. And the preference is mostly for a 1 to 1 body length to leg length ratio. I should note that there are studies all over the place on this issue.
Really long legs are not see as very good, same as really short legs. There is an idea length, but it isn’t that much different from the average leg length.
When it comes to men, women do not have a preference for longer legged men. It seems that a more balance body shape is preferred.
In terms of evolution, all I could find was that when we moved from having four legs to walking on two, longer legs were an advantage. For women, things like waist to hip ratio and boob size and facial beauty were more important as indicators of genetic fitness. In one survey of the literature, a study found that having a sexy voice was key. People with good sexual features, surprise, surprise, got laid younger, had more partners, and cheated more.