Hm, would
```
p = (params[:per_page].presence || 15).to_i
[[15, p].max, 50].min
```
be too clever for you?