I realize this is kind of an old thread, but it came up as I was researching some information about ESPP programs. So, I thought I'd throw this in for anybody else that stumbles upon this thread. The way the contribution limits works is all based on the closing price of the offering date. So, if the stock closes at $20 on the first day of the offering period, and just to simplify things, let's say it is a one year period (instead of the two 6-month periods the OP has). You will be allowed to purchase $25K/$20 = 1250 shares for the year.
If the stock ends up going down by the end of the year, to let's say $18.50, and you get a 15% discount, that means you'll buy 1250 shares at $15.725 each totaling $19,656.25.
If the stock instead goes up for the year, to $23, and you get a 15% discount (in most cases this would be a discount on the opening price for the year), that means you'll buy 1250 shares at $17.00 each totaling $21,250.
So in the first scenario you are only able to put in $19,656.25 and the current value of your 1250 shares is $23,125. In the second you are able to put in $21,250 and the current value of your 1250 shares is $28,750. In the first case your gain is around 17.6%. This is always your gain if the stock goes down over your purchase period. And in the second case your gain is around 35.3%. More importantly, in the second scenario, you were able to put in more money, which means you were able to make more money. So, it is actually a lot better for the stock price to go up over the period. If it always goes up, you'll always end up being able to buy $21,250 which is the same as saying 15% off the $25K limit.