Something that is boiled through and through (sterilized) can be kept for longer than something lightly cooked.
But I'm almost with Peg Bracken (I HATE TO COOK BOOK):
"When In doubt, throw it OUT!"
She also says to notice there's never any leftover veal in wild mushrooms, just a tired old potato, some wilted broccoli, wrinkled peas or a half cup of rice. That food that nobody wanted when it was fresh doesn't get more apealing as it languors in the fridge day after day. Toss it and your life gets simpler...AND no guilt feelings every time you open the fridge and have to look at it laying there.
Measure pasta carefully and there is no waste.
Birds LOVE leftover pasta...I think they think spaghetti = worms!