fmt: GetActionLogs

This commit is contained in:
jamesread 2025-11-06 23:44:56 +00:00
parent 58593c6f04
commit 581536a60f
1 changed files with 14 additions and 10 deletions

View File

@ -484,8 +484,12 @@ func (api *oliveTinAPI) GetActionLogs(ctx ctx.Context, req *connect.Request[apiv
// Newest-first slicing: compute reversed indices // Newest-first slicing: compute reversed indices
startIdx := page.total - page.end startIdx := page.total - page.end
endIdx := page.total - page.start endIdx := page.total - page.start
if startIdx < 0 { startIdx = 0 } if startIdx < 0 {
if endIdx > int64(len(filtered)) { endIdx = int64(len(filtered)) } startIdx = 0
}
if endIdx > int64(len(filtered)) {
endIdx = int64(len(filtered))
}
for _, le := range filtered[startIdx:endIdx] { for _, le := range filtered[startIdx:endIdx] {
ret.Logs = append(ret.Logs, api.internalLogEntryToPb(le, user)) ret.Logs = append(ret.Logs, api.internalLogEntryToPb(le, user))
} }