My new apartment's electric oven has a faulty thermostat. I made a cake from scratch, which took two hours to bake. Yesterday, I made a box mix cake as a gift, which took well over an hour to bake. I'm now concerned for the safety of the recipient. Is it safe to eat a cake that took so long to bake? Are the eggs in it safe? Eventually the cake cooked through, and is not raw in the middle, but I'm worried about the eggs not cooking at the correct temperature. Should I throw it out and go buy one at the bakery, or is it safe to give it as a gift?
First, we have to clear up a common misconception here. The safety of a food product is not the same thing as the sum of the safety of the ingredients that went into it. Neither is it the same as their minimum, nor is there any easy-to-apply rule where you arrive at the safety of the product by looking at the safety of the ingredients. You always have to regard the product as a whole, period. In that sense, egg safety has nothing to do with your situation, because you are dealing with a cake, not with eggs.
From here, you have to apply standard food safety rules for any "cooked" food (and merely mixing ingredients before cooking them counts as cooking for that definition). This means that, before you ended up with a baked cake layer, you are allowed a total of 4 hours of unrefrigerated shelf life. So if the time from starting with making the batter to the time the cake left the danger zone (= it had an internal temperature of 60 C throughout), you are safe. If you didn't use a thermometer and clock to find out the exact time your cake passed the 60 C mark, you have to go with the first moment at which you were sure that it was passed, which is the time you took the baked cake out of the oven (since being baked proves that the cake has had an internal temperature of 96 C).
To bake a cake, I usually have a temperature of 180 °C (360 F). Even if your temperature is lower than that, or fluctuates, this is well above boiling (100 °C) and even more above 60 °C, which is the point of protein denaturation, i.e., everything above 60 °C kills bacteria etc. I'd say the cake is safe to eat, but you should get your oven checked nonetheless, because cooking with a faulty oven is a) inconvenient and b) potentially unsafe (fire hazard)